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;
}