tverghis
tverghis

Reputation: 999

Office 365 Calendar API Using EWS and OAuth 2

Please see edits at the bottom.

I'm trying to work with the Office 365 API using EWS (not the managed API) to create/delete/update events on users' calendars.

So far, I have successfully used Basic Auth to validate that my SOAP request will work. I'm now trying to replace Basic Auth with OAuth 2. I require the use of the Client Credentials Flow.

Here are the steps I followed:

I received the following error (403 Forbidden): The token contains not enough scope to make this call.

What do I need to do to fix this error?

Edit 1: I added the Use Exchange Web Services with full access to all mailboxes application permission, and sending the SOAP message now results in an 500 Internal Server Error...

Upvotes: 2

Views: 2220

Answers (1)

tverghis
tverghis

Reputation: 999

The solution involved the following:

  1. Adding the Use Exchange Web Services with full access to all mailboxes application permission, since EWS doesn't allow the use of more granular permissions.

  2. Adding an ExchangeImpersonation SOAP header for the target mailbox.

  3. Setting the X-AnchorMailbox HTTP header.

Upvotes: 1

Related Questions