Member 13135651 Ответов: 1

Как создать запрос на встречу в outlook с помощью C#


https://i.stack.imgur.com/8xXEn.png[^]

Я хочу создать запрос на встречу, как показано на рисунке, с помощью c# (приложение wpf) и открыть его в окне outlook.

также вы хотите сохранить встречу в календаре

Что я уже пробовал:

Microsoft.Office.Interop.Outlook.Application outlookApplication = new Microsoft.Office.Interop.Outlook.Application(); ;
            Microsoft.Office.Interop.Outlook.AppointmentItem newAppointment = (Microsoft.Office.Interop.Outlook.AppointmentItem)outlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);

            newAppointment.Start = DateTime.Now.AddHours(2);
            newAppointment.End = DateTime.Now.AddHours(3);
            newAppointment.Location = "http://xyz.co/join/7235253940223 ";
            newAppointment.Body ="jigi is inviting you to a scheduled XYZ meeting. ";
            newAppointment.AllDayEvent = false;
            newAppointment.Subject = "XYZ";
            newAppointment.Recipients.Add("Roger Harui");
            Microsoft.Office.Interop.Outlook.Recipients sentTo = newAppointment.Recipients;
            Microsoft.Office.Interop.Outlook.Recipient sentInvite = null;
            sentInvite = sentTo.Add("Holly Holt");
            sentInvite.Type = (int)Microsoft.Office.Interop.Outlook.OlMeetingRecipientType.olRequired;
            sentInvite = sentTo.Add("David Junca ");
            sentInvite.Type = (int)Microsoft.Office.Interop.Outlook.OlMeetingRecipientType.olOptional;
            sentTo.ResolveAll();
            newAppointment.Save();
            newAppointment.Display(true);


Выход:

https://i.stack.imgur.com/Clh0d.png[^]

примечание : Я пробовал несколько решений, но я не получаю кнопку отправки, а также опцию "от и до".

1 Ответов

Рейтинг:
8

Richard Deeming

Чтобы задать элемент встречи в качестве запроса на собрание, необходимо задать MeetingStatus собственность на olMeeting.

newAppointment.MeetingStatus = Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting;


Member 13135651

Огромное спасибо!.