获取收到COMException上的Outlook 2010访问电子邮件时, [英] Getting COMException when accessing Emails on Outlook 2010

查看:184
本文介绍了获取收到COMException上的Outlook 2010访问电子邮件时,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我想通过C#控制台应用程序来访问我在Outlook 2010中的邮件。

Hello I am trying to access my emails in Outlook 2010 via a C# Console Application.

Visual Studio的启动有管理员权限,我已经加入到参考< 。code> Microsoft.Office.Interop.Outlook v14.0.0.0 ,并用它与Outlook

Visual Studio is started with admin rights and I have added a reference to Microsoft.Office.Interop.Outlook v14.0.0.0 and used it as Outlook.

我的代码:

Console.Write("starting");
Outlook.Application app = new Outlook.Application();
Outlook.NameSpace mapiNameSpace = app.GetNamespace("MAPI");
Outlook.MAPIFolder myInbox = mapiNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
Console.WriteLine(((Outlook.MailItem)myInbox.Items[0]).Subject);
Console.WriteLine("readline:");
Console.ReadLine();



第二行,抛出一个错误信息:

The second line, throws an error message:

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



你知道有什么办法呢?

Do you know any solutions?

推荐答案

尝试阅读以下内容: http://support.microsoft.com / KB / 870655

原因:结果
如果许多COM +应用程序不同的用户下运行帐户$ b这是在此用户属性中指定$ b,计算机不能
分配内存以创建新的用户一个新的桌面堆。
因此,该进程无法启动

Cause:
If many COM+ applications run under different user accounts that are specified in the This User property, the computer cannot allocate memory to create a new desktop heap for the new user. Therefore, the process cannot start.

解决方法:
。要解决此问题,修改以下注册表子项中的
的值:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session
Manager\SubSystems\Windows

WORKAROUND: To work around this problem, modify the value of the following registry subkey: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems\Windows

这篇关于获取收到COMException上的Outlook 2010访问电子邮件时,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆