0
我有一個簡單的代碼來在Outlook 2013中使用C#打開撰寫電子郵件。它的工作原理,而不當Outlook未運行任何問題,但是當Outlook已打開我得到這個異常:C#和Outlook之間的例外
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
這裏是我的簡單的代碼:
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.MailItem mailItem = app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
mailItem.Subject = "This is the subject";
mailItem.To = "[email protected]";
mailItem.Body = "This is the message.";
mailItem.Display(true);
我也從Visual Studio輸出得到這些窗戶抱怨我不知道的符號!:
Additional information: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
'mCPanel.vshost.exe' (CLR v4.0.30319: mCPanel.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Outlook\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Outlook.dll'. Module was built without symbols.
'mCPanel.vshost.exe' (CLR v4.0.30319: mCPanel.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\office\15.0.0.0__71e9bce111e9429c\office.dll'. Module was built without symbols.
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
任何幫助表示讚賞? 在此先感謝
我沒有做任何改變。我怎樣才能檢查這個? – NESHOM 2014-10-27 20:48:13
你是否以管理員身份運行任何應用程序?如果使用快捷方式,請查看兼容性選項卡。 – 2014-10-27 21:25:10
我實際上使用visual studio並且正在調試我的代碼。所以不,我沒有使用任何捷徑。任何其他想法? – NESHOM 2014-10-28 03:10:18