Skip to main content

Documentation Index

Fetch the complete documentation index at: https://prismeai-legacy.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

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.

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.
AspectApplication modeDelegated (OAuth) mode
Azure permission typeApplicationDelegated
Admin consentRequiredOptional (user consent if tenant allows)
Mailbox reachAll tenant mailboxes (restrictable)Connected user’s mailbox only
Who authenticatesNo end-user loginEach user signs in once
userId tool argumentRequired (target mailbox)Ignored (always the connected user)
Token acquisitionClient credentials per requestAuthorization code + PKCE; refresh token stored
Best forBack-office / service automationsUser-facing agents, per-user data

Prerequisites

  • An Azure AD Application registered in your tenant
  • Application permissions granted (not Delegated):
    • Mail.Read — Read mail in all mailboxes
    • Mail.ReadWrite — Create drafts, update, delete, move, copy
    • Mail.Send — Send, reply, reply-all, forward
    • MailboxSettings.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 the outlook-mcp workspace.
1

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.
2

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.
3

Microsoft login & consent

The user is redirected to https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize and consents to the delegated scopes.
4

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_in
  • outlook_refresh_token — platform secret, user scope, TTL = 90 days (7776000 s)
  • user.outlook.oauth — metadata only (expiresAt, scope, authMethod: delegated)
5

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).
6

Disconnect

Users can call the disconnectOAuth webhook (or trigger the disconnectOAuth event) to clear all stored tokens and metadata.
Security properties:
  • PKCE (S256) protects the authorization code
  • CSRF state is validated on callback
  • Tokens are stored as platform secrets (opaque references), never as plain user metadata
  • redirectTo is validated against the platform host to prevent open-redirect attacks

Installation

  1. Go to Apps in your workspace
  2. Search for Outlook App and install it
  3. Configure the app instance for your chosen mode (Application or Delegated)

Configuration

FieldValue
Azure Client IDApplication (client) ID from Azure AD
Azure Client SecretClient secret value
Azure Tenant IDDirectory (tenant) ID
Default User IDEmail 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

AutomationDescriptionGraph permission
listMailFoldersList all mail folders with message countsMail.Read
getMailFolderGet folder details by ID or well-known nameMail.Read
listMessagesList messages with filtering, pagination, sortingMail.Read
getMessageGet full message content and metadataMail.Read
searchMessagesSearch messages using KQL syntaxMail.Read
listAttachmentsList all attachments for a messageMail.Read
getAttachmentGet attachment content as base64Mail.Read
getMailboxSettingsGet timezone, locale, automatic repliesMailboxSettings.Read

Send Operations

AutomationDescriptionGraph permission
sendMailSend an email (to/cc/bcc, HTML/text, importance)Mail.Send
sendDraftSend an existing draft messageMail.Send
replyMessageReply to a messageMail.Send
replyAllMessageReply-all to a messageMail.Send
forwardMessageForward a message to recipientsMail.Send

Write Operations

AutomationDescriptionGraph permission
createDraftCreate a draft email in Drafts folderMail.ReadWrite
updateMessageUpdate properties (read status, importance)Mail.ReadWrite
deleteMessageSoft-delete (move to Deleted Items)Mail.ReadWrite
moveMessageMove message to another folderMail.ReadWrite
copyMessageCopy message to another folderMail.ReadWrite

DSUL Examples

List Messages

- Outlook App.listMessages:
    userId: user@company.com   # Application mode only; ignored in Delegated mode
    folderId: inbox
    top: 10
    filter: "isRead eq false"
    output: messages

Send an Email

- Outlook App.sendMail:
    userId: user@company.com
    to: recipient@example.com
    subject: Meeting Follow-up
    body: "<p>Thank you for the meeting today.</p>"
    contentType: HTML
    output: result

Search Messages

- Outlook App.searchMessages:
    userId: user@company.com
    query: "from:john@example.com subject:project"
    top: 20
    output: results

Reply to a Message

- Outlook App.replyMessage:
    userId: user@company.com
    messageId: "{{messageId}}"
    comment: "Thanks for the update!"
    output: result

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.
Application permissions grant access to all mailboxes in the tenant by default. To restrict this connector to a single mailbox, use an Application Access Policy in Exchange Online:
# 1. Connect to Exchange Online
Connect-ExchangeOnline

# 2. Create a mail-enabled security group with only the target mailbox
New-DistributionGroup -Name "OutlookMCP-Allowed" -Type Security -Members user@yourdomain.com

# 3. Restrict the Azure AD app to only access that group's mailboxes
New-ApplicationAccessPolicy -AppId "<your-azure-client-id>" `
  -PolicyScopeGroupId "OutlookMCP-Allowed" `
  -AccessRight RestrictAccess `
  -Description "Restrict Outlook connector to single mailbox"

# 4. Verify (may take up to 30 minutes to propagate)
Test-ApplicationAccessPolicy -AppId "<your-azure-client-id>" -Identity user@yourdomain.com
# Expected: Granted
The PowerShell commands above are provided as general guidance. Always refer to the official Microsoft documentation for the most up-to-date syntax.

Error Handling

HTTP StatusErrorSolution
401Unauthorized (Application mode)Verify clientId, clientSecret, tenant
401User not connected / expired refresh token (Delegated mode)The response includes a connectUrl — the end user must (re)connect at /connect-outlook
403ForbiddenGrant admin consent or check Application Access Policy
404Not FoundVerify user email/ID exists in tenant
429Rate LimitedWait 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