访问重复序列以获取个人预订的详细信息

时间:2018-08-02 06:04:11

标签: c# exchange-server exchangewebservices exchange-server-2010

有什么办法可以Access重复使用日历系列,并通过在Exchange中使用EWS来获得每天的单独预订详细信息(以获取每个日期,时间和位置)< / p>

1 个答案:

答案 0 :(得分:0)

是的,EWS可以做到这一点。下面是一个C#示例。

以下是AppointmentSchema Class

中可供您​​使用的字段的列表
public static Collection<Appointment> FindRecurringCalendarItems(ExchangeService service, 
                                                                    DateTime startSearchDate, 
                                                                    DateTime endSearchDate)
{
    // Instantiate a collection to hold occurrences and exception calendar items.
    Collection<Appointment> foundAppointments = new Collection<Appointment>();
    // Create a calendar view to search the calendar folder and specify the properties to return.
    CalendarView calView = new CalendarView(startSearchDate, endSearchDate);
    calView.PropertySet = new PropertySet(BasePropertySet.IdOnly, 
                                            AppointmentSchema.Subject, 
                                            AppointmentSchema.IsRecurring, 
                                            AppointmentSchema.AppointmentType
                                            AppointmentSchema.Start,
                                            AppointmentSchema.Location);
    // Retrieve a collection of calendar items.
    FindItemsResults<Appointment> findResults = service.FindAppointments(WellKnownFolderName.Calendar, calView);
    // Add all calendar items in your view that are occurrences or exceptions to your collection.
    foreach (Appointment appt in findResults.Items)
    {
        if (appt.AppointmentType == AppointmentType.Occurrence || appt.AppointmentType == AppointmentType.Exception)
        {
            foundAppointments.Add(appt);
        }
        else
        {
            Console.WriteLine("Discarding calendar item of type {0}.", appt.AppointmentType);
        }
    }
    return foundAppointments;
}