Connect Microsoft 365 mail with Graph API
Register an application in Microsoft Entra ID and create a Graph API messaging account that reads and sends one mailbox.
Connect a Microsoft 365 mailbox through Microsoft Graph when you want one messaging account to both collect and send email. The account signs in as an application, so nobody signs in to Microsoft for it.
Before you begin
- You need the
administratorrole in Servicely. - Switch to the Administration workspace with the Workspace selector at the foot of the menu.
- You need permission to create app registrations and grant admin consent in Microsoft Entra ID.
- The messaging account type Microsoft Graph API (Inbound/Outbound Email) is inactive by default. The Type list shows it only once the value is active.
Steps
-
In the Microsoft Entra admin centre, register an application for Servicely. Copy its application (client) ID and its directory (tenant) ID. Microsoft describes the screen in How to register an app in Microsoft Entra ID.
-
In the Microsoft Entra admin centre, open the application’s API permissions. Add the Microsoft Graph application permissions
Mail.Read,Mail.ReadWriteandMail.Send, then grant admin consent. See Web API app registration and API permissions. -
In the Microsoft Entra admin centre, open Certificates & secrets and create a client secret. Copy its value. See Add and manage app credentials in Microsoft Entra ID.
-
In Exchange Online, limit the application to the mailbox Servicely uses. Without a limit, the application permissions apply to every mailbox in the tenant. See Role Based Access Control for Applications in Exchange Online.
-
In Servicely, go to Messaging & notifications → Accounts & channels → Messaging accounts.

The Messaging accounts item in the Messaging & notifications menu. -
Select New and fill in the form.
Field What to enter Example Name A name that identifies the mailbox and the environment. Service desk mailbox (production) Type Microsoft Graph API (Inbound/Outbound Email). Active Yes. Username The mailbox address or user principal name Servicely reads and sends as. servicedesk@example.comTenant Id The directory (tenant) ID you copied. Client Id The application (client) ID you copied. App secret The client secret value you copied. -
Select Create.
-
Select Test Connection. It saves the record, then shows “Connection test successful” when Servicely can read the mailbox.
-
Go to Scripting & automation → Jobs & generators → Jobs and set Active to Yes on the Inbound email processing and Outbound email processing jobs. Both are inactive by default. Create a messaging account shows the job steps.
Result
The messaging account is active and its connection test passes. Every minute, Servicely reads the unread mail in the mailbox’s Inbox, marks it read, and sends waiting email through Graph.
Options
| To | Do this |
|---|---|
| Move collected mail out of the Inbox | Enter Move to folder. Use a well-known folder name such as Archive, a folder’s display name, or one nested level such as Inbox/Processed. If the folder is missing, Servicely logs a warning and leaves the mail in the Inbox. |
| Send notifications that name no account through this account | Set Default to Yes. |