Microsoft Integration
Send emails via Outlook and read calendar events from your AI agents. 30-second setup.
Quick Start
What happens:
- Opens browser to Microsoft OAuth consent screen
- You authorize Mail + Calendar permissions
- Credentials saved to
.env(both local and global~/.co/keys.env) - Ready to use Outlook and Calendar tools immediately
That's it. Your agents can now send emails via Outlook and read your Microsoft calendar.
Prerequisites
Before running co auth microsoft, you must authenticate with OpenOnion:
This creates your OPENONION_API_KEY which is required for Microsoft OAuth to work.
What Gets Saved
After successful authentication, your .env file contains:
Security notes
- •Credentials are saved to both local
.envand~/.co/keys.env - •File permissions set to
0600(read/write for owner only) on Unix systems - •Access tokens expire, but refresh tokens allow automatic renewal
- •You can revoke access anytime via Microsoft Account settings
Permissions Requested
When you run co auth microsoft, we request these Microsoft Graph API scopes:
| Scope | Purpose | What agents can do |
|---|---|---|
| Mail.Read | Read user emails | Read inbox, search emails |
| Mail.Send | Send emails on your behalf | Send emails via Outlook |
| Calendars.Read | Read calendar events | Read your calendar to check availability |
| Calendars.ReadWrite | Create/modify events | Create and update calendar events |
| User.Read | Get your profile | Identify which Microsoft account is connected |
Privacy First
We only request the permissions needed. We cannot:
- ✕Delete your emails
- ✕Access your OneDrive or other services
- ✕Access your contacts beyond basic profile
Using Microsoft OAuth in Agents
Once authenticated, your agents can use Microsoft-powered tools:
Send Email via Outlook
Read Calendar Events
Outlook Tool Methods
The Outlook tool provides these capabilities:
Microsoft Calendar Tool Methods
The MicrosoftCalendar tool provides:
Troubleshooting
"Not authenticated with OpenOnion"
You need to run co auth first to get your OPENONION_API_KEY:
Authorization Timeout
If the browser window doesn't complete authorization within 5 minutes:
The command polls the backend every 5 seconds waiting for your authorization.
Credentials Not Working
Check if credentials are properly saved:
If credentials exist but don't work, re-authenticate:
Revoke Access
To disconnect your Microsoft account:
- 1.Go to Microsoft Account Permissions
- 2.Find "OpenOnion" and click "Remove"
Google vs Microsoft
Both integrations follow the same CLI pattern:
| Feature | Microsoft | |
|---|---|---|
| Command | co auth google | co auth microsoft |
| Gmail | Outlook | |
| Calendar | Google Calendar | Microsoft Calendar |
| API | Google APIs | Microsoft Graph API |
