0

尝试通过 Outlook 自动生成邮件消息 -

添加了对 Microsoft.Office.Interop.Outlook 14.0.0.0 的引用

它可以在 Win 8/Office 2013 PC 上运行,但在 Win 7/Office 2010 上失败并出现以下异常。

代码:

Application outlookApp = new Application();
MailItem message = (MailItem)outlookApp.CreateItem(OlItemType.olMailItem);
message.Subject = "subject";
message.Display(message);
message.HTMLBody = "body" + message.HTMLBody; //to get default signature

例外是:

无法将“System.__ComObject”类型的 COM 对象转换为接口类型“Microsoft.Office.Interop.Outlook.Application”。此操作失败,因为 IID 为“{00063001-0000-0000-C000-000000000046}”的接口的 COM 组件上的 QueryInterface 调用因以下错误而失败:库未注册。(来自 HRESULT 的异常:0x8002801D (TYPE_E_LIBNOTREGISTERED))。

4

1 回答 1

0

Solution ended up being:

http://www.fieldstonsoftware.com/support/support_gsyncit_2013.shtml

Lync 2013 was installed on top of Office 2010. This adds a registry entry to HKCR\TypeLib{00062FFF-0000-0000-C000-000000000046}.

Subkey to that registry entry will be different numbered folders, indicating version numbers of Office installed. (9.4 in this case, indicates 2010, 9.5 indicates 2013). Once the version number not consistent with the version of Outlook was deleted, it was resolved.

于 2013-08-16T18:50:53.883 回答