I'm trying to create an appointment on Outlook using the Outlook Object Model available in C#. I can't find out how to attach a link to a Teams meeting along with the appointment.
Here is what I have, I can't figure out how to generate a meeting link to attach it in the body.
using Outlook = Microsoft.Office.Interop.Outlook;
Outlook.Application outlookApp = new Outlook.Application();
Outlook.Folder calendarFolder = outlookApp.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder;
Outlook.AppointmentItem newAppointment = calendarFolder.Items.Add(Outlook.OlItemType.olAppointmentItem) as Outlook.AppointmentItem;
newAppointment.Subject = ...;
newAppointment.Start = ...;
newAppointment.End = ...;
newAppointment.MeetingStatus = Outlook.OlMeetingStatus.olMeeting;
newAppointment.Body = ...;
// Add attendees to the appointment
Outlook.Recipients recipients = newAppointment.Recipients;
recipients.Add("...");
recipients.Add("...");
recipients.Add("...");
newAppointment.Save();
newAppointment.Send();
Outlook knows very little about Teams - Teams functionality in Outlook is implemented through the Teams COM addin.
You can create a Teams meeting using Graph and embed a link in the appointment body: see https://learn.microsoft.com/en-us/graph/api/application-post-onlinemeetings?view=graph-rest-1.0&tabs=http