我有一种方法可以从Exchange日历中提取约会。 BindToItems方法目前从六个月前开始预约到未来六个月,但在某些时间窗口失败。它将拉出一些约会但报告错误(不再给出详细信息)。有没有办法查看有关错误的更多详细信息,或者是否有人发现我的代码有任何问题(见下文)。
// 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);
答案 0 :(得分:2)
您可以为ews服务启用跟踪侦听器以进行调试
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
service.TraceListener = ITraceListenerInstance;
service.TraceFlags = TraceFlags.EwsRequest | TraceFlags.EwsResponse
service.TraceEnabled = true;
您可以在这些链接上找到更多信息