Hi,
I am not able to send outlook calendar invite from exchange server. But if i installed outlook on my local machine/server it works fine. Below code the i used to build calendar invite for your reference.
public static void sendOutlookInvitationViaICSFile1(EAppointmentMail objApptEmail){
try
{
log.Info("Invite Started");
Microsoft.Office.Interop.Outlook.Application apptApp = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.AppointmentItem agendaMeeting = apptApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
DateTime venueDate = Convert.ToDateTime(objApptEmail.VenueDate);
string formatedVenueDate = venueDate.Year.ToString() + "/" + venueDate.Month.ToString() + "/" + venueDate.Day.ToString();
DateTime from = Convert.ToDateTime(formatedVenueDate + " " + objApptEmail.FromTime);
DateTime to = Convert.ToDateTime(formatedVenueDate + " " + objApptEmail.ToTime);
System.Net.Mime.ContentType typeHTML = new System.Net.Mime.ContentType("text/html");
//Create the Body in HTML format
string strBodyText = "Type:Single Meeting\r\nOrganizer: {0}\r\nStart Time:{1}\r\nEnd Time:{2}\r\nTime Zone:{3}\r\nLocation: {4}\r\n\r\n\r\n\r\n{5}";
strBodyText = string.Format(strBodyText, objApptEmail.Email, from.ToLongDateString() + " " + from.ToLongTimeString(),
to + " " + to, System.TimeZone.CurrentTimeZone.StandardName,
objApptEmail.Location, objApptEmail.Body);
if (agendaMeeting != null)
{
Console.WriteLine("started");
agendaMeeting.MeetingStatus =
Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting;
agendaMeeting.Location = objApptEmail.Location;
agendaMeeting.Subject = objApptEmail.Subject;
agendaMeeting.Body = strBodyText;
agendaMeeting.Start = from;
agendaMeeting.End = to;
Microsoft.Office.Interop.Outlook.Recipient recipient = agendaMeeting.Recipients.Add(objApptEmail.Email);
recipient.Type = (int)Microsoft.Office.Interop.Outlook.OlMeetingRecipientType.olRequired;
((Microsoft.Office.Interop.Outlook._AppointmentItem)agendaMeeting).Send();
log.Info("Invite Successfully End");
Console.WriteLine("End");
}
}
catch (Exception ex)
{
log.Info("Error: " + ex.Message.ToString());
Console.WriteLine("Error: " + ex.Message.ToString());
}
}
In exchange server/ not outlook installed server, i am getting below error.
"Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"
Help me to send calendar invite without installing outlook on the specified server. Please do the needful.