Forum Discussion
"The account does not have permission to impersonate the requested user" error
alex3683 We had exactly the same problem. The solution was to use the X-AnchorMailbox header. More information is here:
https://blogs.msdn.microsoft.com/webdav_101/2015/05/11/best-practices-ews-authentication-and-access-issues/
"When EWS Impersonation is used the X-AnchorMailbox always should be correctly set. Without doing so you may get 500 or 503 errors at times. It is critical for performance and also for notifications with Exchange Online/Exchange 2013. Not setting it can double or more the time it takes to complete the call. In some cases you can also get timeouts. The rule is to always set this header when using impersonation - this will make your EWS Impersonated code from Exchange 2007 work better with Exchange 2013."
stevereinhold SlavaG Thank you both for your help. In the end it was really the missing X-AnchorMailbox header that resolved the issue for us. A pity that this isn't set by default in the EWS API when using impersonation with an email address.