In my website, i am creating Outlook objects and using them to open an outlook file on a button click. It works locally. but when i host it in IIS 8.5 it gives me the following error
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
My code is as follows:
outlook.Application objOutlk = new outlook.Application();
string templatePath = Server.MapPath("Files\\" + file + ".msg");
outlook._MailItem mailitem =
(outlook.MailItem)objOutlk.CreateItemFromTemplate(templatePath);
mailitem.Display(true);