初始化OutlookEmail对象从HRESULT提供异常:0x80029C4A(TYPE_E_CANTLOADLIBRARY) [英] initializing OutlookEmail object gives Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)
问题描述
当我尝试将对象初始化为:
When I try to initialize object as:
OutlookEMail email = new OutlookEMail(MailType);
在C#中我收到异常:
无法将类型为
'Microsoft.Office.Interop.Outlook.ApplicationClass'的COM对象转换为接口类型
'Microsoft.Office.Interop.Outlook._Application'。此操作失败
,因为COM组件上的QueryInterface调用
与IID'{00063001-0000-0000-C000-000000000046}'由于
以下错误而失败:加载错误键入库/ DLL。 (从
HRESULT的异常:0x80029C4A(TYPE_E_CANTLOADLIBRARY))。
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: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).
使用Microsoft Office(outlook)2007.
有人可以帮忙解决吗?
Using Microsoft Office (outlook) 2007. can someone help to resolve that?
推荐答案
我有这个完全相同的错误,只有当我运行最简单的行的代码:
I was having this exact same error, only it was when I ran the most simple line of code:
var outlookApp = new Microsoft.Office.Interop.Outlook.Application();
我尝试了各种修复建议,如运行修复和注册各种组件。修复是将我的项目目标从任何CPU更改为x86。我正在运行Windows 8.1 64位32位Office。
I tried various fixes proposed like running a "repair" and registering various components. The fix was to change my project target from "Any CPU" to "x86". I am running Windows 8.1 64-bit with 32-bit Office.
这篇关于初始化OutlookEmail对象从HRESULT提供异常:0x80029C4A(TYPE_E_CANTLOADLIBRARY)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!