交换EWS API按组织者和时间范围查找约会

时间:2017-09-20 20:17:02

标签: exchange-server exchangewebservices organizer

使用EWS API,我可以使用时间范围和房间的邮箱地址找到约会,如下所示:

public static Appointment GetAppointmentByMailboxAndTimeFrame(ExchangeService EWS,DateTime startDate, DateTime endDate , string mailbox)
    {
        Appointment apt=null;
        try
        {
            // Set the start and end time appointments to retrieve.
            CalendarView cView = new CalendarView(startDate, endDate);
            FolderId CalendarFolderId = new FolderId(WellKnownFolderName.Calendar, mailbox);
            EWS.ImpersonatedUserId = null;
            // Retrieve an appointments by using the calendar view.
            FindItemsResults<Appointment> appointments = EWS.FindAppointments(CalendarFolderId, cView);
            apt= appointments.First();
        }
        catch (Exception)
        {
           apt = null;
        }
        return apt;
    }

我想知道有没有办法使用组织者的电子邮件地址和时间框架预约组织者?这样做的目的只是组织者能够更新约会,而不是参加者(房间也是与会者)

1 个答案:

答案 0 :(得分:0)

您无法将CalendarView与SearchFilter结合使用,因此您无法在一次操作中同时执行这两项操作。 CalendarView是扩展定期约会的必要条件,因此您通常最好限制属性 - 尽可能多地设置返回值,然后在客户端过滤约会。 (从性能的角度来看,无论如何这通常都会更快。)

否则,如果您没有任何需要扩展的定期约会,您可以根据各个属性创建一个SearchFilter。