Hi
I am creating program to send the holiday date of staff from sqlserver table to outlook calendar and I written the sample code. But when I run the code and if no outlook is not open the error is coming as given below
Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)). How I can get rid of this error and make an appointmtent even if the outlook is not open.
private void button1_Click(object sender, EventArgs e){
Microsoft.Office.Interop.Outlook.Application app = null;
Microsoft.Office.Interop.Outlook.AppointmentItem appt = null;
app = new Microsoft.Office.Interop.Outlook.Application();
appt = (Microsoft.Office.Interop.Outlook.AppointmentItem)app
.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
appt.Subject = "Meeting ";
appt.Body = "Test Appointment body";
appt.Location = "TBD";
appt.Start = Convert.ToDateTime("11/11/2016 05:00:00 PM");
appt.Recipients.Add("test@company.com");
appt.End = Convert.ToDateTime("12/11/2016 6:00:00 PM");
appt.ReminderSet = true;
appt.ReminderMinutesBeforeStart = 15;
appt.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh;
appt.BusyStatus = Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy;
appt.Save();
appt.Send();
}
polachan