The Outlook connector provides full access to Microsoft Outlook mailboxes via the Microsoft Graph API, enabling AI agents and automations to read, search, send, and manage emails.Documentation Index
Fetch the complete documentation index at: https://prismeai-docs-next.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Read Operations
List folders, messages, and attachments with filtering and pagination
Send Operations
Send, reply, reply-all, forward emails with HTML support
Manage Messages
Move, copy, delete, and update message properties
Choose your authentication mode
The connector supports two mutually exclusive authentication modes. Pick the one that matches your use case before configuring the connector.Application mode (app-only)
A single Azure AD app acts on behalf of the workspace. Can reach any mailbox in the tenant (restrictable). No per-user login. Best for back-office automations and service accounts.
Delegated mode (OAuth per-user)
Each end user signs into Microsoft once via an OAuth popup. Access is scoped to that user’s own mailbox. Best for agents that act on behalf of the logged-in user.
| Aspect | Application mode | Delegated (OAuth) mode |
|---|---|---|
| Azure permission type | Application | Delegated |
| Admin consent | Required | Optional (user consent if tenant allows) |
| Mailbox reach | All tenant mailboxes (restrictable) | Connected user’s mailbox only |
| Who authenticates | No end-user login | Each user signs in once |
userId tool argument | Required (target mailbox) | Ignored (always the connected user) |
| Token acquisition | Client credentials per request | Authorization code + PKCE; refresh token stored |
| Best for | Back-office / service automations | User-facing agents, per-user data |
Prerequisites
- Application mode
- Delegated (OAuth) mode
- An Azure AD Application registered in your tenant
- Application permissions granted (not Delegated):
Mail.Read— Read mail in all mailboxesMail.ReadWrite— Create drafts, update, delete, move, copyMail.Send— Send, reply, reply-all, forwardMailboxSettings.Read— Read mailbox settings
- Admin consent granted for these permissions
- A client secret created on the app registration
Minimal permissions: If you only need read access,
Mail.Read and MailboxSettings.Read are sufficient. Add Mail.Send and/or Mail.ReadWrite only if you use write tools.OAuth flow (Delegated mode)
When Delegated mode is enabled, end users connect their Microsoft account through a built-in flow implemented by theoutlook-mcp workspace.
User opens the connect page
The user visits
{pagesUrl}/connect-outlook. The page shows a Connect Outlook button when OAuth is configured and the user has no active connection.Initiate
The page (or the
initiateOAuth webhook) generates a PKCE code verifier / code challenge (S256) and a CSRF state, stores them in the user scope, and builds the Microsoft authorize URL.Microsoft login & consent
The user is redirected to
https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize and consents to the delegated scopes.Callback & token exchange
Microsoft redirects back to
/webhooks/oauthCallback?code=...&state=.... The workspace validates the state, exchanges the code (with the PKCE code_verifier) for tokens at https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token, and stores:outlook_delegated_token— platform secret, user scope, TTL =expires_inoutlook_refresh_token— platform secret, user scope, TTL = 90 days (7776000s)user.outlook.oauth— metadata only (expiresAt,scope,authMethod: delegated)
Automatic refresh
When the access token is about to expire,
refreshOAuthToken silently exchanges the refresh token for a new access token (and rotates the refresh token if Microsoft returns a new one).Security properties:
- PKCE (S256) protects the authorization code
- CSRF
stateis validated on callback - Tokens are stored as platform secrets (opaque references), never as plain user metadata
redirectTois validated against the platform host to prevent open-redirect attacks
- Usage as App
- Usage as MCP
Installation
- Go to Apps in your workspace
- Search for Outlook App and install it
- Configure the app instance for your chosen mode (Application or Delegated)
Configuration
- Application mode
- Delegated (OAuth) mode
| Field | Value |
|---|---|
| Azure Client ID | Application (client) ID from Azure AD |
| Azure Client Secret | Client secret value |
| Azure Tenant ID | Directory (tenant) ID |
| Default User ID | Email address or user object ID of the target mailbox |
Available Automations
The automation names and Graph permissions below are identical in both modes; only the permission type (Application vs Delegated) granted in Azure AD differs.Read Operations
| Automation | Description | Graph permission |
|---|---|---|
listMailFolders | List all mail folders with message counts | Mail.Read |
getMailFolder | Get folder details by ID or well-known name | Mail.Read |
listMessages | List messages with filtering, pagination, sorting | Mail.Read |
getMessage | Get full message content and metadata | Mail.Read |
searchMessages | Search messages using KQL syntax | Mail.Read |
listAttachments | List all attachments for a message | Mail.Read |
getAttachment | Get attachment content as base64 | Mail.Read |
getMailboxSettings | Get timezone, locale, automatic replies | MailboxSettings.Read |
Send Operations
| Automation | Description | Graph permission |
|---|---|---|
sendMail | Send an email (to/cc/bcc, HTML/text, importance) | Mail.Send |
sendDraft | Send an existing draft message | Mail.Send |
replyMessage | Reply to a message | Mail.Send |
replyAllMessage | Reply-all to a message | Mail.Send |
forwardMessage | Forward a message to recipients | Mail.Send |
Write Operations
| Automation | Description | Graph permission |
|---|---|---|
createDraft | Create a draft email in Drafts folder | Mail.ReadWrite |
updateMessage | Update properties (read status, importance) | Mail.ReadWrite |
deleteMessage | Soft-delete (move to Deleted Items) | Mail.ReadWrite |
moveMessage | Move message to another folder | Mail.ReadWrite |
copyMessage | Copy message to another folder | Mail.ReadWrite |
DSUL Examples
List Messages
Send an Email
Search Messages
Reply to a Message
Security: Restrict to One Mailbox (Application mode only)
This section applies only to Application mode. Delegated (OAuth) mode is already restricted to the consenting user’s own mailbox and does not need an Application Access Policy.
Error Handling
| HTTP Status | Error | Solution |
|---|---|---|
| 401 | Unauthorized (Application mode) | Verify clientId, clientSecret, tenant |
| 401 | User not connected / expired refresh token (Delegated mode) | The response includes a connectUrl — the end user must (re)connect at /connect-outlook |
| 403 | Forbidden | Grant admin consent or check Application Access Policy |
| 404 | Not Found | Verify user email/ID exists in tenant |
| 429 | Rate Limited | Wait and retry |
Common Issues
AADSTS700016 — App not found in the directory. Check tenant ID matches the app registration.
AADSTS65001 — User has not consented to the required delegated scopes. Either enable user consent in the tenant or have an admin grant consent once.
MailboxNotEnabledForRESTAPI — The user needs an Exchange Online license assigned.
invalid_grant on refresh — The refresh token has expired (>90 days) or been revoked. The user must reconnect via /connect-outlook.
invalid_client — The Azure AD client secret is wrong or has expired. Rotate the secret in Azure AD and update the workspace configuration.
ErrorAccessDenied with Application Access Policy — The target mailbox is not in the allowed security group. Takes up to 30 minutes to propagate after policy changes.
External Resources
Microsoft Graph Mail API
Official API documentation
OAuth 2.0 authorization code flow
Microsoft identity platform — delegated auth code + PKCE
Delegated permissions reference
Microsoft Graph — delegated vs application permissions
Application Access Policies
Restrict mailbox access per application (app-only mode)
Graph Explorer
Test API calls interactively
MCP Specification
Model Context Protocol specification