2

我有以下代码来弹出一个 Outlook 应用程序。它工作得很好,除非我点击“邀请与会者”,否则我无法在弹出窗口中看到实际的与会者文本框。当我单击 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);
    }

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

4

1 回答 1

1

我认为你想要的是一个会议项目,而不是一个约会项目。您不能直接创建 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

与其他 Microsoft Outlook 对象不同,您不能创建此 [例如 MeetingItem] 对象。当您将 AppointmentItem 对象的 MeetingStatus 属性设置为 olMeeting 并将其发送给一个或多个用户时,它会自动创建。他们在收件箱中将其作为 MeetingItem 接收。

于 2013-02-19T01:22:39.983 回答