小编Eri*_*kas的帖子

使用 EWS 托管 API 2.0 为现有约会绑定自定义扩展属性

我想使用自定义扩展属性进行唯一的预约以放入数据库。我使用 FindAppointments() 查找所有约会:

var appointments = _service.FindAppointments(WellKnownFolderName.Calendar, calendarView);
Run Code Online (Sandbox Code Playgroud)

然后我使用 foreach 循环完成所有约会:

foreach (var appointment in appointments)
Run Code Online (Sandbox Code Playgroud)

对于所有没有扩展属性的约会:

if (appointment.ExtendedProperties.Count <= 0)
Run Code Online (Sandbox Code Playgroud)

我绑定了一个自定义扩展属性,并使用我专门生成的唯一会议 ID (meetingId) 设置其值:uniqe int 编号:

var myPropertySetId = new Guid("{6C3A094F-C2AB-4D1B-BF3E-80D39BC79BD3}");
var extendedPropertyDefinition = new ExtendedPropertyDefinition(myPropertySetId, "RateTheMeetingId", MapiPropertyType.Integer);
var bindedAppointment = Appointment.Bind(_service, appointment.Id, new PropertySet(extendedPropertyDefinition));
bindedAppointment.SetExtendedProperty(extendedPropertyDefinition, meetingId);
bindedAppointment.Update(ConflictResolutionMode.AlwaysOverwrite);
Run Code Online (Sandbox Code Playgroud)

但它不起作用,因为我搜索会议并尝试输出扩展属性和 tis 值,但我没有得到结果,它没有绑定。我的问题是我做错了什么以及您可以提供哪些其他解决方案来为现有约会提供自定义扩展属性?顺便说一句,我正在使用 MS Exchange server 2010_SP2。

c# exchange-server exchangewebservices ews-managed-api

2
推荐指数
1
解决办法
4586
查看次数