Overview
Connect your agents to Outlook Calendar and Outlook Email for intelligent scheduling and email automation across Microsoft 365. Agents can manage calendars, schedule meetings, send emails, and interact with your Microsoft ecosystem on your behalf. This integration uses OAuth 2.0 with Azure AD for secure authentication. Users authorize access once, and MagOneAI handles token management and refresh automatically. All credentials are stored in HashiCorp Vault.OAuth setup for Microsoft 365
Before agents can access Microsoft services, you need to configure Azure AD OAuth and users need to authorize access.Configure Microsoft OAuth credentials
In the Admin Portal, navigate to Integrations → Microsoft 365. You’ll need to provide:
- Azure AD Application (client) ID
- Azure AD Client Secret
- Azure AD Tenant ID
Users authorize access through OAuth flow
When a user first uses a Microsoft tool, they’re redirected to Microsoft’s OAuth consent screen. They sign in with their Microsoft account and authorize MagOneAI to access their calendar and email.
Platform manages token storage and refresh
After authorization, MagOneAI stores the access token and refresh token in Vault. The platform automatically refreshes tokens before they expire — users never see authentication errors.
Azure AD app registration required: You need to register an application in Azure Portal with appropriate Microsoft Graph API permissions. See Microsoft’s documentation on app registration for Microsoft Graph.
Outlook Calendar tools
Enable agents to manage calendars, schedule meetings, and check availability across Microsoft 365.List events
Retrieve calendar events for a specific date range. Parameters:calendar_id(optional) — defaults to user’s primary calendarstart_time— ISO 8601 datetime for range startend_time— ISO 8601 datetime for range endmax_results(optional) — maximum number of events to return
Create event
Create a new calendar event with title, time, attendees, location, and optional meeting link. Parameters:calendar_id(optional) — defaults to user’s primary calendarsubject— event titlestart_time— ISO 8601 datetime for event startend_time— ISO 8601 datetime for event endattendees(optional) — list of email addressesbody(optional) — event description/agendalocation(optional) — meeting location or roomis_online_meeting(optional) — whether to create a Teams meeting link
Update event
Modify an existing calendar event. Parameters:calendar_id(optional) — defaults to user’s primary calendarevent_id— ID of the event to updatesubject(optional) — new event titlestart_time(optional) — new start timeend_time(optional) — new end timeattendees(optional) — updated attendee listbody(optional) — new descriptionlocation(optional) — new location
Delete event
Remove a calendar event and send cancellation notices to attendees. Parameters:calendar_id(optional) — defaults to user’s primary calendarevent_id— ID of the event to delete
Check availability
Find free and busy times for one or more attendees using Microsoft’s availability service. Parameters:attendees— list of email addresses to checkstart_time— ISO 8601 datetime for range startend_time— ISO 8601 datetime for range endmeeting_duration(optional) — required meeting duration in minutes
Outlook Email tools
Enable agents to send, read, search, and manage emails across Microsoft 365.Send email
Compose and send an email with subject, body, recipients, and optional attachments. Parameters:to— list of recipient email addressessubject— email subject linebody— email body content (supports HTML)cc(optional) — list of CC recipientsbcc(optional) — list of BCC recipientsattachments(optional) — list of file paths or URLs to attachimportance(optional) — email importance level (low,normal,high)
Read email
Retrieve the content of a specific email by message ID. Parameters:message_id— Outlook message IDinclude_attachments(optional) — whether to include attachment content
Search emails
Find emails matching specific search criteria using Microsoft Graph query syntax. Parameters:query— search query (e.g., “from:[email protected] AND subject:invoice”)folder(optional) — folder to search (defaults to all folders)max_results(optional) — maximum number of results to return
List emails
Retrieve recent emails from inbox or specific folders. Parameters:folder(optional) — folder name or ID (defaults to Inbox)max_results(optional) — maximum number of emails to returnfilter(optional) — OData filter expression (e.g., “isRead eq false”)
Reply to email
Send a reply to an existing email thread. Parameters:message_id— ID of the message to reply tobody— reply body content (supports HTML)reply_all(optional) — whether to reply to all recipients (defaults to false)
Usage in workflows
Microsoft tools can be used in both Agent nodes (for intelligent, flexible execution) and Tool nodes (for deterministic execution).Agent node example
System prompt:- Use
check_availabilityto find when John and Sarah are both free - Select an appropriate time slot
- Use
create_eventwithis_online_meeting: trueto schedule the meeting - Use
send_emailto notify attendees with meeting agenda
Tool node example
For deterministic email sending, use a Tool node: Tool: Send email Parameters:to:["[email protected]"]subject:"Weekly Report - {{date}}"body:{{report_content}}importance:high
Security and permissions
Microsoft Graph API permissions
The Microsoft 365 integration requires these delegated permissions in your Azure AD app registration:Calendars.ReadWrite— read and write user calendarsMail.Send— send emails on user’s behalfMail.Read— read user emailsMail.ReadWrite— read and write user emailsOnlineMeetings.ReadWrite— create Teams meeting links
Credential storage
All OAuth tokens are stored in HashiCorp Vault with:- Encryption at rest using AES-256
- User-scoped access controls
- Automatic key rotation
- Audit logging for all token access
Token refresh
Access tokens expire after 1 hour. MagOneAI automatically:- Detects when a token is about to expire
- Uses the refresh token to obtain a new access token from Azure AD
- Updates the stored token in Vault
- Retries the failed tool call with the new token
Multi-tenant considerations
If your organization uses multiple Microsoft 365 tenants, configure a separate integration for each tenant. Each tenant requires its own Azure AD app registration and OAuth configuration.Troubleshooting
OAuth authorization fails
OAuth authorization fails
Calendar events not syncing
Calendar events not syncing
Symptoms: Events created by agents don’t appear in Outlook or Teams.Solutions:
- Verify the user’s OAuth token has Calendars.ReadWrite permission
- Check that the correct calendar ID is being used
- Confirm timezone handling — use ISO 8601 format with explicit timezone
- Wait a few minutes for sync across Microsoft services
Teams meeting links not generating
Teams meeting links not generating
Symptoms: Events are created but no Teams link is included.Solutions:
- Ensure
is_online_meeting: trueis set when creating the event - Verify the Azure AD app has OnlineMeetings.ReadWrite permission
- Check that the user has a Teams license in their Microsoft 365 subscription
Emails not sending or delayed
Emails not sending or delayed
Symptoms: Send email tool returns success but emails don’t arrive or arrive late.Solutions:
- Check recipient email addresses are valid
- Verify the user’s OAuth token has Mail.Send permission
- Look in the user’s Sent Items folder to confirm emails were sent
- Check recipient spam/junk folders
- Microsoft may delay emails for security scanning — allow a few minutes
Rate limiting or throttling
Rate limiting or throttling
Symptoms: Tools fail with “throttling” or “too many requests” errors.Solutions:
- Microsoft Graph API has rate limits per user and per application
- Reduce the frequency of tool calls if hitting limits
- Implement exponential backoff for retries (MagOneAI does this automatically)
- Consider caching data instead of repeated queries
- Request higher service limits from Microsoft if needed