Retrieving outlook in asp.net web api Fail

0

I need to use Outlook API in my asp.net web api project. When I publish the project to local IIS server, VS need to run as administrator, so I run vs2015 as administrator but problem occurs as below:

Exception Details: System.Runtime.InteropServices.COMException: 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)).

Source Error: 
       public class MailSender
         {
            Outlook.Application olApp = new Outlook.Application();
            Outlook.MailItem mailItem;
            public MailSender()
         } 
outlook
asp.net-web-api2
asked on Stack Overflow Dec 26, 2017 by user9112754 • edited Jan 5, 2018 by Yeraze

1 Answer

0

Outlook, just like any other Office app, cannot be used from a service (such as IIS). Depending on what you need, you can use straight SMTP (if you are sending messages), EWS (if you are accessing an Exchange mailbox), Extended MAPI (C++ or Delphi only), or Redemption (it RDO family of objects wraps Extended MAPI and can be used from any language).


User contributions licensed under CC BY-SA 3.0