Exchange Web 服务:BindToItems 方法返回错误

Exchange Web Service: BindToItems method returning error

我有一种方法可以从 Exchange 日历中提取约会。 BindToItems 方法目前正在从六个月前拉取约会到未来六个月,在某些 windows 的时间失败。它会提取一些约会但会报告错误(没有提供更多详细信息)。有没有办法查看有关错误的更多详细信息,或者是否有人看到我的代码有任何问题(如下)。

// Set the start and end time and number of appointments to retrieve.
Microsoft.Exchange.WebServices.Data.CalendarView cView = new Microsoft.Exchange.WebServices.Data.CalendarView(startDate, endDate, 1000);

// Limit the properties returned to the appointment's subject, start time, and end time. 
cView.PropertySet = new PropertySet(BasePropertySet.IdOnly);

// Retrieve a collection of appointments by using the calendar view.
FindItemsResults<Appointment> currApp = calendar.FindAppointments(cView);

 cView.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties);
 cView.PropertySet.RequestedBodyType = BodyType.Text;
 ServiceResponseCollection<GetItemResponse> apps = service.BindToItems(currApp.Select(r => r.Id), cView.PropertySet);

您可以为 ews 服务启用跟踪侦听器以进行调试

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
service.TraceListener = ITraceListenerInstance;
service.TraceFlags = TraceFlags.EwsRequest | TraceFlags.EwsResponse
service.TraceEnabled = true;

您可以在这些链接上找到更多信息

  1. Enabling tracing and logging EWS
  2. Tracing EWS request