私たちはac#-4.0を持っています。私たちのファイルサーバーに保存されている.msgファイルのリストを表示するDataGridユーザーがグリッド内の行をダブルクリックすると、対応する.msgファイルが開きます。このアプリケーションは、数十のワークステーション(すべてOutlook 2010を搭載したW7 64Bit Proを実行している)に配備され、問題なく動作します。この例外が発生するのは唯一の問題なので、ワークステーション上のOutlookで、 。Outlook 2010 COM hresult:0x80040155 C#アプリケーションの例外ですが、ワークステーションのみです
データグリッドを含むフォーム上で使用される名前空間:
using Office = Microsoft.Office.Core;
using Outlook = Microsoft.Office.Interop.Outlook;
using System.Net;
using System.Net.Mail;
using System.Runtime.InteropServices;
using System.Net.Mime;
using System.Globalization;
のVisual Studio 2010のプロジェクトで参照:
- Microsoft.Office.Core Microsoft.Office.Interop.Outlook( Verson 14.0.0.0)
- Microsoft.Office.Interop.Word Microsoft.Office.Tools.Common.v4.0.Utilities
- Microsoft.Offi GridViewのDoubleClickイベントでce.Outlook.v4.0.Utilities
:
Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();
// The following line is where the exception is thrown.
Microsoft.Office.Interop.Outlook.MailItem mail = (Microsoft.Office.Interop.Outlook.MailItem)oApp.Session.OpenSharedItem(Settings.Default.msgFilePath + @"\SL_Imported_Files\Customer\OLI\PA\SL_Int_" + inID + ".msg");
if (mail != null)
mail.Display(false);
Marshal.ReleaseComObject(mail);
mail = null;
例外メッセージ:
{"Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063001-0000-0000-C000-000000000046}' failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155)."}
私はthisスレッドから受け入れ答えをチェックしましたし、私のHKEY_CLASSES_ROOT\TypeLib\{00062FFF-0000-0000-C000-000000000046}
は9.4
であり、2010年を除き私のワークステーションにインストールされたOutlookの他のバージョンはありません