Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

And with that, we have successfully requested and stored our access token for the second JSON tool.

Sending the Email

Courtesy to Microsoft's documentation and this Stackoverflow guide, to send an email, we will need another POST request with the link:

https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/sendMail

or

https://graph.microsoft.com/v1.0/users/me/sendMail

For this guide, we will be using the first one, enter the appropriate information to your second JSON tool and make the Body Type as "Custom JSON Payload".

Image Added

This "id | userPrincipalName" refers to the ID or "principal name" of the user that will be sending the email. The format of an ID will be a 32 long random string seperated into 5 sections, while the format of a principal name will look like an email address. Most emails and IDs will be invalid when palced in the request link, to see which emails are allowed, you can check it in your Azure profile.

From the Home screen go to:

  1. Azure Active Directory
  2. Users

And in that screen you can see a list of all the valid users, it should be filled with around a dozen dummy accounts and your account. Copy paste your or any of the "User Principal Name" in that list to your request link and this time the request will be valid.

Optionally, you can extract both the "User Principal Name" and their ID, by doing a GET request to the link,

https://graph.microsoft.com/v1.0/users

Feed this GET request with a non-expired access token and if the request is successful, you will be presented with an array of JSON objects that represents all of the user's information, including their "User Principal Name" and ID. It is also important to note, this is where that optional API permission "User.Read.All" is used. For this guide, this method will not be used.

After pasting the appropiate request link, time to feed it the JSON PayloadDancing cow

Demo App

Here is the demo app that showcases this guide, please do keep in mind all of the information related to the Azure app has been left empty since those should be filled with your own Azure app. Most of these empty information can be find in the process of the application.

...