我试图用VB.Net查询EWS,并且我可以检索大多数属性为我想要的约会,但是当我试图检索IsCancelled属性遇到以下exception: This property was requested, but it wasn't returned by the server.
任何人都可以build议是否有任何IsCancelled属性问题(即它总是设置为true或false)?
我们的环境是混合的,EWS是从Exchange 2007SP1运行的,但是我们有2010服务器(即将在一个月左右开始升级)。
任何人都可以通过EWS指向所有属性上的任何资源,列表很长,我相信还有其他有用的gem,我还没有偶然发现。
任何将邮箱中的约会设置为资源的资源(使用2010年的房间,但还没有),如已取消和更新的会议将不胜感激。
谢谢,
马特
根据属性的文档 ,它是一个booltypes,而不是Nullable<bool>所以它应该总是返回一些东西。
事实上,你得到This property was requested, but it wasn't returned by the server消息This property was requested, but it wasn't returned by the server可能表明你要求一个不适当的属性返回的项目(即要求在EmailMessagetypes的isCancelled属性。
我会做的是一个简单的健全性检查,并validation您返回的项目列表是所有typesAppointment而不是别的。
您可以尝试调用ExchangeService类的FindAppointments方法,该方法将专门查找约会的项目,但是我个人遇到了一些问题,而这些问题并不完全符合我的预期。 我最终做的是调用FindItems<Appointment>(WellKnownFolderName.Calendar, new ItemView(1000))并循环这些。
经过大量的试验和错误之后,我发现当你想要AppointmentSchema.AppointmentState属性时,你也需要请求AppointmentSchema.IsCancelled属性。
这是我有哪些工作的代码:
var calendarView = new CalendarView(startTime, endTime); var folderId = new FolderId(WellKnownFolderName.Calendar, new Mailbox(room.Email.Address)); calendarView.PropertySet = new PropertySet( // AppointmentState is required for IsCancelled to work AppointmentSchema.AppointmentState, AppointmentSchema.IsCancelled ); var roomBookings = exchangeService.FindAppointments(folderId, calendarView);