# Connecting to the Microsoft Graph API

Before starting the Graph setup within MailScheduler, you will need to have a Tenant ID, Client ID, and Client secret.&#x20;

To do this, you will need to create an App Registration in Entra / Azure.

<figure><img src="https://content.gitbook.com/content/OEnvavVjEKojggGVc69T/blobs/HU55FVfsFhVdH3dU5OPr/Screenshot%202025-06-27%20at%2009.35.31.png" alt=""><figcaption><p>Step 1: Choose a name</p></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/OEnvavVjEKojggGVc69T/blobs/WAColLLchz3BhllYm9tc/Screenshot%202025-06-27%20at%2009.36.32.png" alt=""><figcaption><p>Step 2: Choose Single Tenant</p></figcaption></figure>

Afterwards, you can copy your **Tenant ID** and **Client ID** from the *overview* Part of your App registration:

<figure><img src="https://content.gitbook.com/content/OEnvavVjEKojggGVc69T/blobs/fnaJfpHa5EW2WDskvlcf/image.png" alt=""><figcaption><p>Entra app overview</p></figcaption></figure>

Now, you can navigate to the Microsoft Graph tab in the MailScheduler Settings, where you will see this screen:

<figure><img src="https://1937398298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOEnvavVjEKojggGVc69T%2Fuploads%2FDLBGR3fCIyGejjwAgO94%2Fimage.png?alt=media&#x26;token=472f75ea-690f-468b-87aa-df7e935cbab3" alt=""><figcaption></figcaption></figure>

Paste your Tenant ID and Client ID in their respective fields. Next, we will set up the return URL. Press the button next to the URL here, to copy it to your clipboard, and then head back to Entra. Navigate to the 'Authentication' part of your app registration, and click 'Add URI', and then web. Paste the return URL into the field, and click add.

After adding the return URL, you will see two checkboxes in the Authentication part of the Entra management panel, one for 'Access tokens', and one for 'ID tokens'. Make sure that ID tokens are checked, and save your authentication setup.

It will need to be entered in the 'Authentication' part of your App registration. Make sure that 'ID tokens' is selected.

#### Client secret

Navigate to 'Certificates & secrets'. Under the secrets header, make a new client secret, and copy the client secret value into correct field in Mailscheduler.

<figure><img src="https://content.gitbook.com/content/OEnvavVjEKojggGVc69T/blobs/ki6vjQnD1Vjkfr3RKzoT/image.png" alt=""><figcaption><p>An example of a secret</p></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/OEnvavVjEKojggGVc69T/blobs/1c87xZ2mQEPGFNBnBn62/image.png" alt=""><figcaption><p>Where to fill in the secret</p></figcaption></figure>

#### Deciding on Permission scope

Depending on whether you want to use the Microsoft Graph API to only send Emails, Teams messages, or both, you can select a different permissions scope:

<figure><img src="https://1937398298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOEnvavVjEKojggGVc69T%2Fuploads%2FGbKXiqko2FBW4VC51AHg%2Fimage.png?alt=media&#x26;token=e8de7fb7-0a44-4075-86c5-b811d9395f42" alt=""><figcaption></figcaption></figure>

For each scope, the only included permissions are the bare minimum for their respective functions.

#### Final step

Finally, click 'Save MS Graph Settings', and then press 'Authenticate with Microsoft Graph'. This will will open up a dialog, where you need to log in with the account that you want to use to send emails and / or Teams messages. It is recommended to create a new 'Mailscheduler' user.&#x20;

In the dialog window, you may be asked to request permission to the app from an Administrator. After pressing 'request', wait for the required permission, and then simply go through the authentication process again, by clicking on the same button.

When you get this popup screen, your setup was successful!

<figure><img src="https://content.gitbook.com/content/OEnvavVjEKojggGVc69T/blobs/sxd2MMZBxglX5gqoyTgs/image.png" alt=""><figcaption><p>Congratulations! You are ready to start sending emails with the Microsoft Graph API.</p></figcaption></figure>
