You must Sign In to post a response.
  • Category: ASP.NET

    80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

    Hello friends,
    I am trying to send mail from outlook to gmail from c# code.The code is as follows.



    Application OutlookApplication = new Application();
    MailItem message = (MailItem)OutlookApplication.CreateItem(OlItemType.olMailItem);
    Microsoft.Office.Interop.Outlook.Accounts accounts = message.Session.Accounts;
    foreach (Microsoft.Office.Interop.Outlook.Account account in accounts)
    {

    string _emailID = account.SmtpAddress;
    if (account.SmtpAddress == _emailID)
    {
    message.SendUsingAccount = account;
    MailAddress toAddress = new MailAddress(txtto.Text.Trim());
    message.To = toAddress.ToString();
    message.Subject = txtsubject.Text;
    message.Body = txtmessage.Text;
    message.BodyFormat = OlBodyFormat.olFormatHTML;
    message.Send();
    // ((Microsoft.Office.Interop.Outlook._MailItem)message).Send();
    break;
    }
    }

    once I am trying to run this code on server. I am encountered with 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)).

    Please help me to resolve the issue


    Thanks
    Navneet
  • #761280
    Hi

    You can go through Below link for Resolved this issue it may be helpful to you


    http://www.codeproject.com/Questions/274286/microsoft-office-interop-error

    http://www.codeproject.com/Questions/410833/Getting-Error-while-reading-outlook-mail-in-ASP-NE


    http://stackoverflow.com/questions/9575984/allowing-access-to-outlook-interop-in-web-forms-project

    http://stackoverflow.com/questions/17785063/retrieving-the-com-class-factory-for-component-error-80070005-access-is-de

    http://www.c-sharpcorner.com/Forums/Thread/209248/-exception-from-hresult:-0x80070005-(e_accessdenied).aspx

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #761282
    Hai Navneet,
    This is common issue which can occur due to various reasons:
    1. The COM component(for the outlook) is not registered to the current system in Win32 folder.
    2. The COM component is not accessible due to the current user permission level.
    3. The COM component is not matching with the windows version. COM components are different for 32 and 64 bit machines.
    So you need to check all these things to resolve the issue.
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


Sign In to post your comments