1

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.

Gurudeepak
  • 372
  • 2
  • 14
  • Are you using the token from getCallbackTokenAsync to make the graph call? – Outlook Add-ins Team - MSFT Jan 19 '21 at 22:16
  • Regarding [your deleted question](https://stackoverflow.com/questions/65664733/custom-email-send-button-for-outlook-outlook-add-in-yomen-office-react-and), I think it is just too brief for Stack Overflow. An attempt at a problem is a good idea but not mandatory, but design-stage questions are just too broad and will prompt guesswork in answers. A question being answered does not mean that it is automatically on-topic, and in this case perhaps a comment reply would have been better - the answer was just boilerplate copy+paste anyway. – halfer Jan 20 '21 at 11:48
  • "If it was too brief or invalid why would Outlook Add-ins Team - MSFT team will respond?" - I covered this in my earlier reply. To expand on what I said, unfortunately there are some answerers who don't care about the posting guidelines here, and I'd say that applies in this case. Such users do not vote or care much for what constitutes a good question - they just use Stack Overflow as a support portal. – halfer Jan 20 '21 at 19:49

1 Answers1

0

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.