问题
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
- Enabling tracing and logging EWS
- Tracing EWS request
来源:https://stackoverflow.com/questions/31406770/exchange-web-service-bindtoitems-method-returning-error