Error : Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))
public MeetingDVO sendOneTimeMeeting(MeetingDVO dvo) { log.Info("In side Send Onetime Meeting"); object outlookObject = null; Outlook.Application oApp = null; Outlook.AppointmentItem agendaMeeting = null; Account acc = null; string status = string.Empty; try { outlookObject = Marshal.GetActiveObject("Outlook.Application"); if (outlookObject != null) { log.Info("Marshal Object Created"); oApp = new Outlook.Application(); } else { oApp = new Microsoft.Office.Interop.Outlook.Application(); } if (true) { log.Info("creating outlook Object"); //oApp = new Outlook.Application(); //oApp = CreateOrAttachToOutlookApplication(); log.Info("Object created"); agendaMeeting = (Outlook.AppointmentItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem); log.Info(" agendaMeeting Object created"); acc = SetAccount(oApp); log.Info(" Account created"); if (agendaMeeting != null) { log.Info(" in side Account IF"); Outlook.NameSpace nameSpace = oApp.GetNamespace("MAPI"); log.Info(" Namespace"); agendaMeeting.MeetingStatus = Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting; agendaMeeting.Location = dvo.Location; agendaMeeting.Subject = dvo.Subject; agendaMeeting.Body = dvo.Body; agendaMeeting.Start = dvo.TimeSlot; agendaMeeting.Duration = dvo.Duration; //agendaMeeting.RequiredAttendees = "skoswattha@emaar.ae;KCornelio.dul@emaar.ae"; agendaMeeting.RequiredAttendees = "skoswattha@emaar.ae"; //agendaMeeting.RequiredAttendees = "skoswattha@emaar.ae"; //agendaMeeting.ForceUpdateToAllAttendees = true; //agendaMeeting.ResponseRequested = true; ((Outlook._AppointmentItem)agendaMeeting).SendUsingAccount = acc; ((Outlook._AppointmentItem)agendaMeeting).Send(); dvo.EntryID = agendaMeeting.EntryID; dvo.Remarks = MeetingSucess; } else dvo.Remarks = MeetingError + " : " + "Meeting Object is Null"; } } catch (System.Exception ex) { log.Info(ex.InnerException +":::::: MESSAGE----"+ex.Message); dvo.Remarks = MeetingError + " : " + ex.Message; } finally { oApp = null; agendaMeeting = null; acc = null; } return dvo; }
outlookObject = Marshal.GetActiveObject("Outlook.Application");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)