Exchange Web Service: BindToItems method returning error

你说的曾经没有我的故事 提交于 2020-01-05 00:01:49

问题


I have a method which pulls appointments from the Exchange calendar. The BindToItems method, which is currently pulling appointment from six months ago until six months in the future, fails with certain windows of time. It will pull some appointments but reports an error (no more details are given). Is there a way to see more details about the error, or does anyone see any problems with my code (below).

// 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);

回答1:


You can enable trace listener for the ews service for debugging

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

You can find more on these links

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


来源:https://stackoverflow.com/questions/31406770/exchange-web-service-bindtoitems-method-returning-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!