Exception thrown: 'Microsoft.Exchange.WebServices.Data.ServiceResponseException' in Microsoft.Exchange.WebServices.dll

无人久伴 提交于 2019-12-13 00:50:09

问题


I'm trying to learn using EWS API. I want to retrieve all the appointments from my calendar.

I used the following technique to get the appointments:

CalendarFolder folder = CalendarFolder.Bind(service, WellKnownFolderName.Calendar);
CalendarView view = new CalendarView(startDate, endDate);
FindItemsResults<Appointment> results = folder.FindAppointments(view);

Assume that the startDate and endDate are given.

My code keeps crashing at WellKnownFolderName.Calendar

And I get this exception:

'Microsoft.Exchange.WebServices.Data.ServiceResponseException' in Microsoft.Exchange.WebServices.dll

The ErrorCode is 'ErrorImpersonateUserDenied' The Message is The account does not have permission to impersonate the requested user.

But I am trying to access my account only with the EWS API. And I cannot give delegate access to myself from outlook.

Any help is appreciated.

来源:https://stackoverflow.com/questions/32062394/exception-thrown-microsoft-exchange-webservices-data-serviceresponseexception

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