Error while access local machine outlook emails from web application

368 views Asked by At

I have made a C#.net application to access all my folders and emails from my local machine outlook. To make this application I have used COM object, my application is working fine with my local machine using link localhost:51514/mymail/list

Sample code

Microsoft.Office.Interop.Outlook.Application app = null;
app = new Microsoft.Office.Interop.Outlook.Application();
ns = app.GetNamespace("MAPI");
ns.Logon("[email protected]","password", true, true);

Globals.ThisAddIn.Application.CreateItem(Outlook.OlItemType.olMailItem);

MapModel.InboxFolder = app.ActiveExplorer().Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
MapModel.CategoryList = SetCategoryList(MapModel.InboxFolder);

but when I put this application on server and then try to access my email I get error at runtime.

ERROR: 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)).

The requirement of my project : where ever I open my application, it should access all emails from Microsoft outlook on that machine and list emails in my application.

seeking for some help, Thanks in advance.

0

There are 0 answers