yanik
yanik

Reputation: 818

Microsoft Graph access token for single user within Outlook add-in

Is there is a way to get Microsoft Graph access token from Azure AD within Outlook add in? Technically user is logged in when Outlook is open, so from outlook add in I can get email ID (internetMessageId https://dev.office.com/reference/add-ins/outlook/1.5/Office.context.mailbox.item?product=outlook&version=v1.5), username, etc.

I want to use email id and token to retrieve single email message https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/message_get

But is it possible to generate Azure AD access token not making the user log in once again like in the example? https://github.com/AzureAD/microsoft-authentication-library-for-js

Cheers

Upvotes: 3

Views: 1237

Answers (1)

Marc LaFleur
Marc LaFleur

Reputation: 33132

You can obtain a token for using with Graph/Outlook REST APIs using the Office.context.mailbox.getCallbackTokenAsync() method introduced in Mailbox 1.5.

There is a walkthrough of this in the docs: Use the Outlook REST APIs from an Outlook add-in.

Upvotes: 2

Related Questions