试图到Outlook自动化作为展望互操作异常
Microsoft.Office.Interop.Outlook.Application myApp = new Microsoft.Office.Interop.Outlook.ApplicationClass();
Microsoft.Office.Interop.Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI");
并获得以下异常在第二线即GetNamespace
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: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
我使用.Net Framework 4
和Outlook 2013
。
是this唯一的解决方案!因为我正试图避免对注册表进行任何更改。
编辑
this没有解决问题。
编辑 如果引用的库是Office 15并且安装的库是10或12,它会工作吗?
试图http://stackoverflow.com/questions/4656360/unable-to-cast-com-object-microsoft-outlook-c-sharp?rq=1 – bjan