0
votes

I'm trying to build a simple outlook plugin using VS2013 and c# Is working fine for outlook 2010 but is crashing in outlook 2013 with this error at this line:

Outlook.application o = new Outlook.Application();

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))

VS and outlook are running under same user, the OS is windows 7, same integrity level.

Thanks, Marius

1
I think that this error occurs because the Outlook and the application running on different user permission levels (one of them as administrator and the other one as regular user)Jonas W
thanks for your comment, how do I correct this?MariusP

1 Answers

1
votes

The following statements:

I'm trying to build a simple outlook plugin

and

Outlook.application o = new Outlook.Application();

are incompatible!

You need to use the Application property available in add-ins. If you develop a VSTO based add-in check out the Application property of the add-in class.

Anyway, the following error description states that you try to automate Outlook from a windows service:

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))

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. Read more about that in the Considerations for server-side Automation of Office article.

You may consider using a low-level code from a service instead - Extended MAPI or any third-party wrappers around that API.