2

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?

Community
  • 1
  • 1
Patsuan
  • 137
  • 8
  • Using the linked code try adding `appointmentItem.MeetingStatus = Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting;` before `.Display()`. – Alex K. Mar 08 '17 at 16:23
  • Possible duplicate of [Open the Outlook meeting window with a button](https://stackoverflow.com/questions/38098485/open-the-outlook-meeting-window-with-a-button) – Shahar Shokrani Jan 21 '18 at 10:34

2 Answers2

1

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("test@test.com");
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);
NineBerry
  • 26,306
  • 3
  • 62
  • 93
0

One more note to NineBerries good solution, because I had an issue here:

The line

appointmentItem.Recipients.ResolveAll();

is necessary if you have optional attendees in the meeting. Otherwise they will be reset to "required" even if you set

recipient.Type = Microsoft.Office.Interop.Outlook.OlMeetingRecipientType.olOptional;

before, which is due to "late auto-resolving" of names in Outlook (or so it seems).

Marcel
  • 26
  • 3