Eric Legault
Eric Legault

Reputation: 5834

Use token from Outlook web add-in for EWS write operations

Is it possible to use any tokens from an Outlook add-in for use with authenticating EWS Managed API operations that create or update items?

Apparently the token returned from mailbox.getCallbackTokenAsync can only be used in read operations. I can indeed verify that is a problem because attempts to send emails or call UserConfiguration.Update result in an error:

The requested web method is unavailable to this caller or application.

I have been testing these methods from an ASP.NET Web API App Service in Azure, called from JavaScript in the Outlook add-in.

Apparently mailbox.getUserIdentityTokenAsync can be used to validate a user, but it is not clear if that can be used in conjunction with OAuthCredentials for ExchangeService.Credentials.

Are there any options here? I cannot ask the user for their username and password to authenticate with Exchange. I am certainly willing to use Graph or the Mail API, but AFAIK there are no ways to update user configuration items with those APIs.

Upvotes: 2

Views: 558

Answers (1)

Marc LaFleur
Marc LaFleur

Reputation: 33124

You're looking for makeEwsRequestAsync(). Both CreateItem and UpdateItem operations are supported makeEwsRequestAsync.

You can find the full list of supported EWS operations in the documentation under EWS operations that add-ins support.

There is also support for calling into Microsoft Graph via the add-in but as you noted, Microsoft Graph supports a very limited number mailbox configuration options.

Upvotes: 1

Related Questions