試圖到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