【问题标题】:EWS: Accessing an appointments recurrence patternEWS:访问约会重复模式
【发布时间】:2012-05-22 10:43:04
【问题描述】:

我正在尝试在下面的代码中获取与约会相关的重复模式。当我调试代码并在 Locals 窗口中展开 microsoftAppointment.Recurrence 属性时,我可以看到一个名为 [Microsoft.Exchange.WebServices.Data.Recurrence.WeeklyPattern] 的嵌套类,其中包含我需要的信息,但我无法弄清楚如何在我的代码中访问这些信息。显然在内存中,我只是不明白为什么在运行时无法在代码中读取它。我试过 FindAppointments 但它只返回 Recurrence 为空。

FindItemsResults<Item> findResults = exchangeService.FindItems(WellKnownFolderName.Calendar, new ItemView(folderCount));

exchangeService.LoadPropertiesForItems(findResults.Items, new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Location, AppointmentSchema.Body, AppointmentSchema.Start, AppointmentSchema.End, AppointmentSchema.IsAllDayEvent, AppointmentSchema.Body, AppointmentSchema.IsRecurring, AppointmentSchema.Recurrence));

foreach (var v in findResults.Items)
{
    Microsoft.Exchange.WebServices.Data.Appointment microsoftAppointment = v as Microsoft.Exchange.WebServices.Data.Appointment;

    if (microsoftAppointment.IsRecurring)
    {
    ...
    }
}

【问题讨论】:

    标签: c# exchangewebservices


    【解决方案1】:

    以下演员表最终对我有用。您可以跳过间隔模式步骤,但在那之后我做了一个切换来查找类型(每周、每天等),因此我可以正确地转换间隔模式。

    Microsoft.Exchange.WebServices.Data.Recurrence.IntervalPattern pattern = (Microsoft.Exchange.WebServices.Data.Recurrence.IntervalPattern)microsoftAppointment.Recurrence;
    weeklyPattern = (Microsoft.Exchange.WebServices.Data.Recurrence.WeeklyPattern) pattern;
    

    【讨论】:

      猜你喜欢
      • 2012-06-17
      • 2017-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多