Outlook Calendar and Email
Integrate Microsoft 365 tools with your agents for scheduling and communication
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.
Looking to keep agents grounded in SharePoint documents? That's handled separately by knowledge-base sync, which mirrors a SharePoint document library into a knowledge base for retrieval and citations. See Knowledge bases → Syncing from external sources.
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
These are created by registering an application in the Azure Portal. The platform stores them securely in HashiCorp Vault.
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.
Agents can now access Microsoft services
Once authorized, agents can call Outlook Calendar and Email tools on behalf of the user. Credentials are injected at runtime when tools execute.
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 list, create, update, and delete calendar events 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
Returns: List of events with subject, start time, end time, attendees, location, and meeting details.
Example use case: "Show me all my meetings this week so I can prepare."
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
Returns: Created event details including event ID and Teams meeting link if requested.
Example use case: "Schedule a 30-minute Teams meeting with john@example.com tomorrow at 2pm to discuss the quarterly report."
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
Returns: Updated event details.
Example use case: "Move my 3pm meeting to 4pm and add sarah@example.com as an attendee."
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
Returns: Confirmation of deletion.
Example use case: "Cancel my meeting with the client tomorrow."
Outlook Email tools
Twenty tools, grouped below by what they do. Most take an email_id returned by one of the listing or search tools.
Reading and finding
list_emails— list recent emails from a folder. Takesfolder(defaultinbox),max_results(default 20, max 100),unread_only, andskipfor pagination. Returns id, subject, from, date, and a snippet.list_email_headers— a much lighter listing that returns only id, subject, from, and date. No body preview, CC, or attachment info. Use it when scanning a large mailbox.get_email— full content of one email. Optionallymark_as_read.get_email_bodies— truncated plain-text bodies for up to 10 emails in one call, withmax_body_length(default 3000 chars). Saves a round trip per message.get_email_thread— every message in a conversation, oldest first, with HTML stripped. Up to 50.search_emails— search with KQL syntax, for examplefrom:user@example.com,subject:report, orhasAttachments:true.match_emails— fuzzy match against subject and sender using local scoring, consuming no LLM tokens. Cheaper than asking an agent to sift results itself.get_unread_count— unread and total count for a folder.
Sending and replying
send_email— requiresto,subject, andbody. Optionalcc,bcc,is_html,importance(low/normal/high),save_to_sent(default true), andattachment_urls(up to 10 file URLs).reply_email— reply to a message. Optionalreply_all, plus extraccandbcc.forward_email— forward to new recipients, with an optionalcommentadded above the forwarded content.
Drafts
create_draft— save an email without sending it. Same fields assend_email.list_drafts— list saved drafts, paginated.send_draft— send an existing draft bydraft_id.
Drafts pair well with a Human Task node: have the agent call create_draft, route the draft to a person for approval, then call send_draft only once they approve. Nothing leaves the mailbox without a human seeing it.
Attachments
list_attachments— list the attachments on an email.download_attachment— download attachment content as base64. Limited to 25MB by default (MAX_ATTACHMENT_DOWNLOAD_SIZE_MB).
Organising the mailbox
mark_emails— bulk mark up to 50 emails read or unread.move_email— move to another folder, by well-known name (inbox,archive,deleteditems,junkemail) or a folder ID.delete_email— move an email to Deleted Items.list_folders— list folders with unread and total counts. Use the returned IDs withmove_email.
Shared mailboxes. get_email, list_attachments, and download_attachment accept a mailbox parameter. Pass an address to read a shared mailbox using app-only authentication instead of the signed-in user's own mailbox.
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:
You are a scheduling assistant for Microsoft 365. When asked to schedule meetings:
1. List existing events with the Outlook calendar tool to see what is already booked
2. Find a time slot that works for everyone
3. Create the calendar event with Teams meeting link if remote meeting
4. Send confirmation emails to all attendees with meeting details
Always suggest Teams meetings for remote participants.User message:
Schedule a 1-hour meeting with john@example.com and sarah@example.com
sometime next week to discuss Q1 planning. Make it a Teams meeting.The agent will:
- Use
list_eventsover next week to see what is already on the calendar - 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:["john@example.com"]subject:"Weekly Report - {{date}}"body:{{report_content}}importance:high
The tool executes with exactly these parameters every time, using variable values from the workflow context.
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
Users see these permissions when they authorize access through the OAuth consent screen.
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
Tokens are retrieved from Vault only during tool execution and immediately discarded from memory after use.
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
Users never see "token expired" errors during workflow execution.
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
Symptoms: Users see error during Microsoft sign-in or authorization fails.
Solutions:
- Verify Azure AD Application ID, Client Secret, and Tenant ID are correct in Admin Portal
- Check that redirect URIs are configured correctly in Azure AD app registration
- Ensure the app has required Microsoft Graph API permissions
- Verify admin consent has been granted if required by your organization
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
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
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
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