C# interop Outlook: Unable to cast COM object of type ‘Microsoft.Office.Interop.Oulook.ApplicationClass’

1.5k views Asked by At

c# code to send e-mail via MS Outlook 2010 developed in VS 2010 works perfect:

1. using Outlook = Microsoft.Office.Interop.Outlook;
...
2. Outlook.Application outlookApp = new Outlook.Application();
3. Outlook.MailItem mail = outlookApp.CreateItem(Outlook.OlItemType.olMailItem) as Outlook.MailItem;
...

When using this programm on another pc with MS Outlook 2013: following error occurs on line 3:

Unable to cast COM object of type ‘Microsoft.Office.Interop.Oulook.ApplicationClass’ to interface type ‘Microsoft.Office.Interop.Oulook._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)).

Deleting Outlook Interop reference and adding latest version 15 in VS 2013 does NOT help. How can I use Outlook 2013 to send mail? Is it possible to use Outlook 2010 with same code?

0

There are 0 answers