Access Denied OutLook DCOM

0

I'm trying an ASP.NET App and I have a problem with OutLook.

Code behind :

OutlookApplication = new Application();
NameSpace nameSpace = OutlookApplication.GetNamespace("MAPI");
nameSpace.Logon("", "", missing, missing);
nameSpace = null;

When I play the app with Visual Studio it's ok.

When I play the app with IIS then :

System.UnauthorizedAccessException: Retrieving the COM class factory for >component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the >following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 >(E_ACCESSDENIED)).

I already tried to change DCOM Configuration for "OutLook Message Attachment" with :

Proprieties -> Identity -> Execute user

Proprieties -> Security -> all kind of acces autorized for "everybody".

NB : I have no problem with others Office programm (Excel and Word).

iis
outlook
asp-classic
dcom
asked on Stack Overflow Sep 23, 2015 by GrayFox • edited Jul 6, 2020 by Martijn Pieters

1 Answer

0

I'm trying an ASP.NET App and I have a problem with OutLook.

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.

As a workaround you may consider using a low-level API on which Outlook is based on (Extended MAPI) or any third-party wrappers around that API, for example, Redemption.

answered on Stack Overflow Sep 23, 2015 by Eugene Astafiev

User contributions licensed under CC BY-SA 3.0