Search code examples
c#.netoutlook-2016

Is it possible to directly open the Outlook meeting window?


I am trying to have my application to open the Outlook meeting window with some pre-populated fields.

I have found that this question was already asked here. However, the code provided in the answer(which works fine) doesn't open the meeting window but the appointement window. Those are two different things that are handled differently in Outlook and what I need is indeed the meeting window.

Is there any way to achieve this or do I absolutely have to open the appointement window first and then invite people to turn it into a meeting?


Solution

  • Create an appointment just as in the other question, but then set the MeetingStatus property of the appointment.

    Microsoft.Office.Interop.Outlook.Application outlookApplication = new Microsoft.Office.Interop.Outlook.Application(); ;
    Microsoft.Office.Interop.Outlook.AppointmentItem appointmentItem = (Microsoft.Office.Interop.Outlook.AppointmentItem)outlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
    
    // This line was added    
    appointmentItem.MeetingStatus = Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting;
    
    appointmentItem.Subject = "Meeting Subject";
    appointmentItem.Body = "The body of the meeting";
    appointmentItem.Location = "Room #1";
    appointmentItem.Start = DateTime.Now;
    appointmentItem.Recipients.Add("[email protected]");
    appointmentItem.End = DateTime.Now.AddHours(1);
    appointmentItem.ReminderSet = true;
    appointmentItem.ReminderMinutesBeforeStart = 15;
    appointmentItem.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh;
    appointmentItem.BusyStatus = Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy;
    appointmentItem.Recipients.ResolveAll();
    appointmentItem.Display(true);