Reputation: 431
Requirement:
When user clicks on Custom Command Button
send a Email.
Access Token: We are getting the Access Token using the below code.
Office.context.mailbox.getCallbackTokenAsync({ isRest: true }, function(result) {})
What we achieved:
We are able to send a email from the Custom Command Button
using the REST API https://outlook.office.com/api/v2.0/me/sendmail
with the Access Token.
Problem with REST API:
We came to know that Outlook Mail REST API is deprecated and will be out of service from November 2022
Replacement API/Service:
As mentioned in the Outlook API Docs, We need to use the Graph API
.
Problem with Replacement API/Service:
As per the docs we need to setup SSO/OAuth for this API. But we don't want to do these things. We just want to keep the solution simple i.e when user clicks Custom Command Button
send Email with any authentication process.
Question
Is there any method/way we can directly call the Graph API using the Access Token without any SSO/OAuth/Azure setup? Currently we are receiving 401 Unauthorised Access
error message.
Upvotes: 2
Views: 434
Reputation:
Unfortunately, there's no way to call Microsoft Graph APIs using the token from Office.context.mailbox.getCallbackTokenAsync
. That is probably why you received the 401 Unauthorised Access
error.
Upvotes: 0