我有以下代码来弹出一个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);
}
有没有办法如何自动显示与会者文本框而无需点击“邀请与会者”按钮?另外,无论如何以程序方式调用“检查名称”以便与会者得到解决?
答案 0 :(得分:1)
我认为你想要的是一个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);
快速背景:来自microsoft:http://msdn.microsoft.com/en-us/library/office/microsoft.office.interop.outlook.meetingitem(v=office.14).aspx
与其他Microsoft Outlook对象不同,您无法创建此对象[例如 MeetingItem]对象。它是在您设置时自动创建的 AppointmentItem对象的MeetingStatus属性为olMeeting和 将其发送给一个或多个用户。他们在收件箱中收到它作为 MeetingItem。