Skip to main content
Use the Outlook Connector to ingest emails from a Microsoft 365 mailbox via the Microsoft Graph API into the mAItion knowledge base.

What It Does

  • fetches emails from a configurable mail folder in a Microsoft 365 mailbox
  • authenticates directly against Microsoft Entra ID using the OAuth2 client credentials flow (app-only, non-interactive)
  • converts HTML email bodies to Markdown for indexing
  • runs ingestion on configurable schedules

Authentication

Only the client credentials flow (app-only) is supported. This requires:
  • An Azure app registration that can read the target mailbox, using one of the two options below.
  • A Microsoft 365 / Entra ID work or school account mailbox. Personal Microsoft accounts are not supported — client credentials flow is not available for them.

Mailbox Access Options

The Entra ID Mail.Read application permission is unscoped: it grants access to every mailbox in the tenant. The user_email setting only selects which mailbox this connector queries. It does not limit what the app registration can reach.
To use the scoped option, follow RBAC for Applications in Exchange Online: create a management scope, register the app’s service principal in Exchange with New-ServicePrincipal, then assign the role with New-ManagementRoleAssignment -App <service-principal-id> -Role "Application Mail.Read" -CustomResourceScope <scope>.
After you assign the scoped role, remove the unscoped Mail.Read grant from Entra ID. The two grants combine as a union, so if the Entra ID grant stays, the app keeps access to every mailbox and the scope has no effect.

Required Environment Variables

Set these in .env.rag:
  • OUTLOOK1_CLIENT_ID: Azure app registration client ID
  • OUTLOOK1_CLIENT_SECRET: Azure app registration client secret
  • OUTLOOK1_TENANT_ID: Azure tenant / directory ID
  • OUTLOOK1_USER_EMAIL: mailbox owner email address (example: user@company.onmicrosoft.com)
  • OUTLOOK1_SCHEDULES: ingestion interval in seconds (default is 3600)

config.yaml Example

.env.rag Example

Configuration Reference

Multiple Outlook Sources

Add more sources entries (outlook2, outlook3, etc) with separate env vars per source.