如何使用C#在Outlook中创建会议预约请求 [英] How to create meeting appointment request in outlook using C#

查看:320
本文介绍了如何使用C#在Outlook中创建会议预约请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



我想创建会议预约请求,如使用c#(wpf app)在图像中显示,并在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邀请您参加预定的XYZ会议。;
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 [ ^ ]



note :我尝试了一些解决方案,但我没有收到发送按钮以及来自和选项。

解决方案

要将约会项目设置为会议请求,您必须将 MeetingStatus 属性设置为 olMeeting



 newAppointment.MeetingStatus = Microsoft.Office.Interop.Outlook.OlMeeting Status.olMeeting; 


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

I want to create meeting appointment request like shown in image using c# (wpf app) and open it in outlook window.

also want to save appointment into calendar

What I have tried:

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);



Output:

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

note : I tried few solution but i'm not getting send button and also from and to option.

解决方案

To set an appointment item as a meeting request, you must set the MeetingStatus property to olMeeting.


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


这篇关于如何使用C#在Outlook中创建会议预约请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆