c# - EWS : Accessing an appointments recurrence pattern

标签 c# exchangewebservices

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

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)
    {
    ...
    }
}

最佳答案

以下 Actor 最终为我工作。您可以跳过“间隔模式”步骤,但我在此之后进行了切换以查找类型(每周、每天等),以便我可以正确地转换间隔模式。

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

关于c# - EWS : Accessing an appointments recurrence pattern,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10656136/

相关文章:

c# - 序列化 : Change the name of the root node without changing the class name

.net - 测试 Exchange Web 服务 (EWS)

c# - 使用手动设置凭据时,EWS 自动发现停止工作

java - 找不到自动发现服务

c# - 在 IdentityDbContext 和主应用程序 DbContext 之间共享用户表

c# - 如何在 C# 中将参数传递给新的 RoutedEventHandler 方法?

c# - 使用类型和操作在 C# 中查找表

c# - Console.Writeline 适用于 x86 但不适用于 x64

c# - 使用 Exchange Web 服务 API 确定邮箱是否存在

c# - 尝试使用 EWS MANAGED API 访问 Exchange 2010 帐户时“找不到自动发现服务”