2

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?

Stefano Sanfilippo
  • 32,265
  • 7
  • 79
  • 80
nic
  • 21
  • 2
  • possible duplicate of [Why cannot I cast my COM object to the interface it implements in C#?](http://stackoverflow.com/questions/16938467/why-cannot-i-cast-my-com-object-to-the-interface-it-implements-in-c) – Hans Passant Jan 16 '14 at 22:30
  • [STAThread] was already added by Main. Adding this [STAThread] to mailfunction did not work out – nic Jan 18 '14 at 16:34

0 Answers0