none
Access Denied in DCOM Config RRS feed

  • Question

  • Hi,

    I am trying to access outlook object and code is below.I created Virtual Directory and deployed the code in IIS.I am getting Access denied error when i try to access outlook object.

      myOutlook.Application application = null;

                try
                {
                    if (Process.GetProcessesByName("OUTLOOK").Count() > 0)
                    {
                        application = Marshal.GetActiveObject("Outlook.Application") as myOutlook.Application;
                    }

    Please help me how to get access to outlookk object.

    Thanks,

    Vijay


    Monday, September 18, 2017 12:07 AM

All replies

  • Don't use Office Automation (i.e.: those COM object to manipulate MS Office programs) in web environment.

    This is especially bad for Outlook, where it's operation is tightly coupled with "current user's profile" of the user running Outlook, and usually the web application runs under NetworkService/Application Identity context, so it'd create security complications (it's possible to adjust the security settings to allow it to run, but also note that Outlook can execute binaries so it's general a bad idea).

    If your company uses Exchange 2010+, you should use Exchange Web Service (EWS) to access mailbox functionality instead.



    • Edited by cheong00 Monday, September 18, 2017 1:38 AM
    Monday, September 18, 2017 1:33 AM
  • Hi Vijay,

    According to your question is more related to Outlook, I will move it to Outlook for Developers forum for suitable support.

    This forum discuss and ask the C# programming language, IDE, libraries, samples and tools.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 18, 2017 8:10 AM
  • Hello Vijay,

    As cheong said, Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment. For more information, please visit Considerations for server-side Automation of Office:

    In addition to these issues, one of the following common errors may occur when you try to automate Office server-side:
    • The CreateObject function and the CoCreateInstance function return one of the following run-time error messages and cannot be started for Automation.
      Message 4
      E_ACCESSDENIED (0x80070005): Access denied

    If you want to send mail, I would suggest you use SMTP. You could visit How to send email in ASP.NET C# to see different methods.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 19, 2017 1:53 AM
    Moderator