Outlook 2007中从C# - COM异常,TYPE_E_LIBNOTREGISTERED [英] Outlook 2007 from C# - COM exception, TYPE_E_LIBNOTREGISTERED

查看:696
本文介绍了Outlook 2007中从C# - COM异常,TYPE_E_LIBNOTREGISTERED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一个程序,将打开新的Outlook 2007邮件。

I'm trying to make a program that would open new Outlook 2007 message.

我从COM选项卡上的Microsoft Outlook 12.0 ObjectLibrary引用。

I've referenced from COM tab Microsoft Outlook 12.0 ObjectLibrary.

这些项目中引用在VS出现了:

These items showed up in references in VS:

Microsoft.Office.Core
Microsoft.Office.Inerop.Outlook

现在我尝试调用下面code:

Now I try to invoke following code:

var _outlookInstance = new Microsoft.Office.Interop.Outlook.Application();
var _message = (OutlookApp.MailItem)_outlookInstance.CreateItem(OutlookApp.OlItemType.olMailItem);

在这里OutlookApp == Microsoft.Office.Interop.Outlook命名空间。

where OutlookApp==Microsoft.Office.Interop.Outlook namespace.

在调用房源我不断收到此异常的第二行:(InvalidCastException的)

While invoking second line of listing I keep getting this exception: (InvalidCastException)

无法投类型的COM对象
  Microsoft.Office.Interop.Outlook.ApplicationClass
  接口类型
  Microsoft.Office.Interop.Outlook._Application。
  此操作失败,因为
  在COM调用QueryInterface
  组件是对IID接口
  {00063001-0000-0000-C000-000000000046}
  由于以下错误失败:
  库未注册。
  (从HRESULT异常:0x8002801D
  (TYPE_E_LIBNOTREGISTERED))。

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: Library unregistered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).

这code运作良好,对Outlook 2003中我的其他工作站上。

That code worked well for Outlook 2003 on my other station.

我会很感激的任何想法如何解决这个问题。

I'll be grateful for any ideas how to solve it.

推荐答案

这也有可能发生,当你已经卸载了一间办公室安装2013,你回到办公室2010。
可能有一些注册表键和左dll文件,导致Office应用程序加载DLL错误(S)。

This can also happen, when you have uninstalled an office 2013 installation and you return to office 2010. There might be some registry keys and dlls left, which cause the office application to load the wrong dll(s).

下面是此修复程序:<一href=\"http://www.fieldstonsoftware.com/support/support_gsyncit_2013.shtml\">http://www.fieldstonsoftware.com/support/support_gsyncit_2013.shtml

这篇关于Outlook 2007中从C# - COM异常,TYPE_E_LIBNOTREGISTERED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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