Asp.net get account names from outlook express

94 views Asked by At

I have created an application for listing account names connected to outlook express. It runs successfully when running from visual studio, but it is not working after publishing on iis.

Here is my Code :

public static DataTable GetCompleteAccountNames()
    {
        DataTable dt = ERPCommonMethods.CreateDataTable(new string[] { "AccountName" });

        Microsoft.Office.Interop.Outlook.NameSpace _ns;
        Microsoft.Office.Interop.Outlook.Application _application = new Microsoft.Office.Interop.Outlook.Application();
        _ns = _application.Session;
        Microsoft.Office.Interop.Outlook.Folders objCompleteAccounts = _ns.Folders;
        DataRow dr = null;
        foreach (Microsoft.Office.Interop.Outlook.Folder objSingleAccount in objCompleteAccounts)
        {
            dr = dt.NewRow();
            dr["AccountName"] = objSingleAccount.Name;
            dt.Rows.Add(dr);
        }
        return dt.Select("", "AccountName ASC").CopyToDataTable();
    }

after publishing on iis, the following error occures...

Server Error in '/' Application.

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

can any one help me....

0

There are 0 answers