locked
"Outlook.Application" Accsess Denid message in asp.net page RRS feed

  • Question

  • Hi All,

    I'm trying to create an object of Outlook.Application so as to be able to send a calendar invites from the asp.net page. I am able to do so using .vcs files as an attachment with the mail. But I need to send the meeting invite using the Outlook and not as an attachment. The problem is: The moment I say

    Outlook.Application app = new Outlook.Application();

    the application throws an error saying: "Access is denied.
    Exception Details: System.UnauthorizedAccessException: Access is denied."

    I tried many things including giving rights to the asp.net user on the local machine, making him a member of the admin group... but nothing seems to work.

    Could you please help to know if its possible to use Outlook object in the asp.net application. If not, what are the constraints and security risk that it can cause and remedies for the same.

    Appreciate your help with this.
    Thanks,
    Sandeep

    Below is the code:
        public static void SendMail2()
        {
            Outlook.Application objOL = new Outlook.Application().;
            Outlook.AppointmentItem objAppt = (Outlook.AppointmentItem)objOL.CreateItem(Outlook.OlItemType.olAppointmentItem);
            System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
            objAppt.Start = ScheduledDateTime.ToUniversalTime();
            objAppt.End = ScheduledDateTime.ToUniversalTime().AddMinutes(45);
            objAppt.Subject = "Test";
            objAppt.Body = "Test body message"; ;
            objAppt.MeetingStatus = Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting;
            objAppt.RequiredAttendees = objTo.Email;
            objAppt.Recipients.Add(objTo.Email);
            objAppt.Send();
            objAppt = null;
            objOL = null;
        }



    Wednesday, August 13, 2008 6:56 AM

All replies

  • Hi,

     

    Outlook is no server application. It won't work since the user profile is not loaded when you run inside the IIS.

     

    Use another protocol (WebDAV in case of Exchange 2003, Exchange WebServices in case of Exchange 2007).

     

    If your website runs directly on the Exchange Server, you can also use CdoEx.

     

    Kind regards,

    Henning Krause

    Thursday, August 14, 2008 5:09 PM