azureexchangewebservicesewsjavaapiazure-acs

Exchange Web Services are not currently available for this request because none of the Client Access Servers in the destination site could process


I am using EWS Java APIs and passing OAuth tokens to fetch data from office 365 mailboxes.

Because I am developing Web APIs I preferred using "Application Permissions" defined in Azure active directory application for Office 365, and used "client credential flow" OAuth flow to fetch OAuth token specific to application which will allow "Have full access via EWS to all mailboxes in the organisation".

After fetching token with the procedure specified in the document "http://blogs.msdn.com/b/exchangedev/archive/2015/01/21/building-demon-or-service-apps-with-office-365-mail-calendar-and-contacts-apis-oauth2-client-credential-flow.aspx"

I passed this token to EWS Java APIs,

it gave me error saying:

microsoft.exchange.webservices.data.ServiceResponseException: Exchange Web Services are not currently available for this request because none of the Client Access Servers in the destination site could process the request.

I tried similar thing with EWS managed APIs for .net. Got similar error.

Can anyone provide some help and direction to resolve this error.

Thanks & Best Regards,

Pranjal


Solution

  • I was able to resolve the issue, by simply adding following line of code service.getHttpHeaders().put("X-AnchorMailbox","smtpemailaddress");