Skip to main content
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.

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

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

Send Operations

Write Operations

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

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