Click here to Skip to main content
15,889,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello I am trying to access my emails in Outlook 2013 via a C#windows service Application.
Visual Studio is started with admin rights and I have added a reference to Microsoft.Outlook 15.0 Bbject Library and used it as Outlook.
My Code:
C#
Outlook.Application myApp = new Outlook.Application();
Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI");
ns = myApp.GetNamespace("MAPI");

The First line, throws an error message:

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

Do you know any solutions?
Posted
Updated 23-Apr-16 3:07am
v2

1 solution

Googing this you'll find that you can NOT use Outlook interop, or any Office application, inside a non-interactive session, like a web site or a Windows service app. It is not a supported solution. It MAY work here and there, but it is not guaranteed to work all of the time.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900