Exception between C# and Outlook

NESHOM

I have a simple code to open a compose email in Outlook 2013 using C#. It works without any issues when Outlook is not running, but when Outlook is already open I get this exception:

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)).

Here is my simple code:

        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);

I also get these from Visual Studio output windows complaining about symbols which I have no idea about!:

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)).

Any help is appreciated? Thanks in advance

Dmitry Streblechenko

Most likely this is caused by a difference in security contexts. Is either Outlook or your app running with elevated privileges?

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Outlook召回消息C#

来自分类Dev

为ManagementObjectNotFoundException和ActiveDirectory / Outlook尝试Catch / Exception

来自分类Dev

C#Outlook加载项优化

来自分类Dev

C#Outlook-被叫方拒绝的呼叫

来自分类Dev

在C#中分配Outlook任务

来自分类Dev

从C#打开新的Outlook消息

来自分类Dev

C#使用Outlook发送邮件

来自分类Dev

从C#代码启动Outlook 2013

来自分类Dev

C#-Outlook-访问新日历

来自分类Dev

C#:编辑Outlook 2010昵称缓存

来自分类Dev

无法通过C#从Outlook发送邮件

来自分类Dev

从C#代码启动Outlook 2013

来自分类Dev

Outlook赎回登录错误C#

来自分类Dev

C#和Outlook之间的异常

来自分类Dev

C#关闭共享的Outlook日历

来自分类Dev

C#-Outlook-访问新日历

来自分类Dev

C#Outlook以编程方式访问CommandBar

来自分类Dev

Outlook邮件应用程序C#

来自分类Dev

C#Outlook-被叫方拒绝的呼叫

来自分类Dev

如何使用C#更新Outlook约会?

来自分类Dev

获取共享的 Outlook 日历事件 C#

来自分类Dev

Visual C++ Outlook 自动化

来自分类Dev

包括<exception>标头C ++

来自分类Dev

Raise unhandled C exception in Python

来自分类Dev

包括<exception>标头C ++

来自分类Dev

创建邮件时阅读Outlook加载项(C#)中的Outlook附件内容

来自分类Dev

使用Microsoft.Office.Interop.Outlook连接到Outlook的稳定性C#表单

来自分类Dev

C#捕获Outlook电子邮件正文

来自分类Dev

C#Outlook外接程序无法正确安装