gpt4 book ai didi

c# - Outlook VSTO - 当我调用 appointment.Display() 时如何显示 "Invite attendees"文本框?

转载 作者:太空宇宙 更新时间:2023-11-03 13:47:04 26 4
gpt4 key购买 nike

我有以下代码来弹出 outlook apptitem。效果很好,除非我单击“邀请与会者”,否则我无法在弹出窗口中看到实际的与会者文本框。当我单击 appt 项目上的那个按钮时,它会显示我在下面填充的人员列表。

 public void BookAppt(List<string> rooms, DateTime startTime, DateTime endTime)
{
var PacktAppointmentItem = (Microsoft.Office.Interop.Outlook.AppointmentItem)Globals.ThisAddIn.Application.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
PacktAppointmentItem.Subject = "Test Meeting";
PacktAppointmentItem.Location = "My Room";
PacktAppointmentItem.Start = startTime;
PacktAppointmentItem.End = endTime;
PacktAppointmentItem.Body = "Test Meeting";
PacktAppointmentItem.RequiredAttendees = String.Join(";", rooms);
PacktAppointmentItem.Display(true);
}

有什么方法可以自动显示与会者的文本框,而无需单击“邀请与会者”按钮?另外,有没有以编程方式调用“检查姓名”以便解决与会者的问题?

最佳答案

我认为您想要的是 MeetingItem,而不是 AppointmentItem。您不能直接创建 MeetingItem,但您几乎可以创建任何地方:只需在您的代码中添加以下行:

PacktAppointmentItem.MeetingStatus = Outlook.OlMeetingStatus.olMeeting;

所以你的最终代码应该是这样的

var PacktAppointmentItem = (Microsoft.Office.Interop.Outlook.AppointmentItem)Globals.ThisAddIn.Application.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
PacktAppointmentItem.Subject = "Test Meeting";
PacktAppointmentItem.Location = "My Room";
PacktAppointmentItem.Start = DateTime.Now;
PacktAppointmentItem.MeetingStatus = Outlook.OlMeetingStatus.olMeeting;
PacktAppointmentItem.End = DateTime.Now.AddHours(1.0);
PacktAppointmentItem.Body = "Test Meeting";
PacktAppointmentItem.RequiredAttendees = String.Join(";", rooms);
PacktAppointmentItem.Display(true);

快速背景:来自微软:http://msdn.microsoft.com/en-us/library/office/microsoft.office.interop.outlook.meetingitem(v=office.14).aspx

Unlike other Microsoft Outlook objects, you cannot create this [e.g. MeetingItem] object. It is created automatically when you set the MeetingStatus property of an AppointmentItem object to olMeeting and send it to one or more users. They receive it in their inboxes as a MeetingItem.

关于c# - Outlook VSTO - 当我调用 appointment.Display() 时如何显示 "Invite attendees"文本框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14939999/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com