Microsoft 365
Microsoft 365 Email Setup
Connect OpenCaddis to your Microsoft 365 account to read, search, and send email through agents. This uses the device code OAuth flow — no client secrets needed.
Step 1: Azure App Registration
- Go to the Azure Portal → Microsoft Entra ID → App registrations → New registration
-
Name:
OpenCaddis(or any name you prefer) - Supported account types: Select "Accounts in any organizational directory and personal Microsoft accounts"
- Redirect URI: Leave blank (device code flow does not require one)
- Click Register
- After creation, copy the Application (client) ID from the Overview page
Add API Permissions
Go to API permissions → Add a permission → Microsoft Graph → Delegated permissions. Add:
| Permission | Type | Purpose |
|---|---|---|
Mail.Read | Delegated | Read emails |
Mail.ReadWrite | Delegated | Send emails and manage drafts |
User.Read | Delegated | Read user profile (display name, email) |
offline_access | Delegated | Maintain access via refresh tokens |
Step 2: Configuration
Add your Application (client) ID to opencaddis.json:
opencaddis.json
{
"Microsoft365": {
"ClientId": "YOUR-APPLICATION-CLIENT-ID-HERE"
}
}
Then add the Microsoft365Email plugin to any agent:
opencaddis.json — Agent with Email
{
"Handle": "Email Assistant",
"AgentType": "assistant",
"Models": ["default"],
"SystemPrompt": "You help manage email. Summarize messages and draft replies.",
"Plugins": ["Microsoft365Email", "Memory"]
}
Step 3: Authentication
OpenCaddis uses the device code flow — a browser-based sign-in that doesn't require client secrets.
- Open OpenCaddis and switch to an agent with the
Microsoft365Emailplugin - The agent will display a device code and a verification URL
- Visit the URL in your browser, enter the code, and sign in with your Microsoft account
- Once authenticated, tokens are stored encrypted locally
- Tokens auto-refresh 5 minutes before expiry — no need to re-authenticate
First-Time Setup
You only need to complete the device code flow once. After that, OpenCaddis will automatically refresh your access token using the stored refresh token.
Security
- Tokens encrypted at rest — stored using ASP.NET Data Protection in the
.keysdirectory - No client secrets — device code flow means no secrets in configuration files
- Delegated permissions only — the app acts as the signed-in user, never with app-level access
- Local storage only — tokens never leave your machine