C# 访问定期系列以获取个人预订的详细信息

C# 访问定期系列以获取个人预订的详细信息,c#,exchange-server,exchangewebservices,exchange-server-2010,C#,Exchange Server,Exchangewebservices,Exchange Server 2010,是否有任何方法可以访问定期日历系列,并通过使用EWS获取每天的个人预订详细信息(以获取每个日历系列的日期、时间和位置)是的,这在EWS中是可能的。下面是一个C#示例 以下是可从中访问的字段列表 公共静态收集FindRecurringCalendarItems(ExchangeService服务, DateTime startSearchDate, 日期时间结束搜索日期) { //实例化集合以保存事件和异常日历项。 Collection foundAppointments=新集合(); //创建日

是否有任何方法可以
访问定期日历系列,并通过使用
EWS
获取每天的个人预订详细信息(以获取每个日历系列的日期、时间和位置)

是的,这在EWS中是可能的。下面是一个C#示例

以下是可从中访问的字段列表

公共静态收集FindRecurringCalendarItems(ExchangeService服务,
DateTime startSearchDate,
日期时间结束搜索日期)
{
//实例化集合以保存事件和异常日历项。
Collection foundAppointments=新集合();
//创建日历视图以搜索日历文件夹并指定要返回的属性。
CalendarView calView=新日历视图(startSearchDate、endSearchDate);
calView.PropertySet=新的PropertySet(仅BasePropertySet.IdOnly,
任命模式。主题,
AppointmentSchema.IsRecurring,
AppointmentSchema.AppointmentType
AppointmentSchema.Start,
任命模式。位置);
//检索日历项的集合。
FindItemsResults findResults=service.findAppoints(WellKnownFolderName.Calendar,calView);
//将视图中发生或例外的所有日历项添加到集合中。
foreach(findResults.Items中的约会应用程序)
{
if(appt.AppointmentType==AppointmentType.Occurrence | | appt.AppointmentType==AppointmentType.Exception)
{
foundappoints.Add(appt);
}
其他的
{
WriteLine(“丢弃{0}类型的日历项”,appt.AppointmentType);
}
}
返回预约;
}

当我尝试此功能时,个人预订详细信息显示为空白。请查看附件中的屏幕截图,我使用了与您提供的相同的代码。事实上,代码运行正常。但是检索到的数据显示异常。您可以在屏幕截图中查看相同的代码,这很难帮助您提供信息,但请确保您在时间范围内有约会(
startSearchDate
endSearchDate
)是否有任何可能的方法可以根据原始的家长推荐会议ID获取个人预订详细信息?
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;
}