Skip to main content

Overview

Microsoft 365 integration provides access to Outlook, Calendar, OneDrive, Teams, and other Microsoft services through Microsoft Graph API.

Supported Services

  • Outlook Email - Send, read, and manage emails
  • Calendar - Schedule events and manage availability
  • OneDrive - Access and manage files
  • Teams - Channel and chat integration
  • Contacts - Access and manage contacts
  • To Do - Task management

Setup

1. Register Application in Azure

  1. Go to Azure Portal
  2. Navigate to “Azure Active Directory” > “App registrations”
  3. Click “New registration”
  4. Enter application details:
    • Name: “Praxos”
    • Supported account types: Choose based on needs
    • Redirect URI: https://your-domain.com/auth/microsoft/callback

2. Configure API Permissions

Add delegated permissions: Mail
  • Mail.Read
  • Mail.ReadWrite
  • Mail.Send
Calendar
  • Calendars.Read
  • Calendars.ReadWrite
Files
  • Files.Read.All
  • Files.ReadWrite.All
Teams (optional)
  • Team.ReadBasic.All
  • Channel.ReadBasic.All
  • ChatMessage.Send

3. Create Client Secret

  1. Go to “Certificates & secrets”
  2. Click “New client secret”
  3. Set expiration (recommended: 24 months)
  4. Copy the secret value immediately

4. Configure Praxos

Add to .env:
MICROSOFT_CLIENT_ID=your-application-id
MICROSOFT_CLIENT_SECRET=your-client-secret
MICROSOFT_TENANT_ID=your-tenant-id
MICROSOFT_REDIRECT_URI=https://your-domain.com/auth/microsoft/callback

User Authorization

OAuth flow for user authorization:
  1. User requests Microsoft integration
  2. Praxos provides authorization URL
  3. User signs in with Microsoft account
  4. Grants requested permissions
  5. Tokens stored securely
  6. Integration complete

Features

Outlook Email

Send Emails
User: Send an email to jane@company.com
Praxos: What should the subject and message be?
User: Subject: Team Update, Message: [...]
Praxos: ✓ Email sent to jane@company.com
Read Emails
User: Show my recent emails
Praxos: Recent emails:
         1. Sarah - Project Status Update (10 min ago)
         2. Mike - Meeting Notes (1 hour ago)
         3. Team - Weekly Newsletter (2 hours ago)
Search and Filter
User: Find emails from last week about "budget"
Praxos: Found 4 emails about "budget" from last week...

Calendar

Schedule Meetings
User: Schedule a 1-hour meeting with john@company.com tomorrow at 3pm
Praxos: Meeting scheduled:
         Title: Meeting with John
         Time: Tomorrow, 3:00 PM - 4:00 PM
         Attendee: john@company.com
         [View in Outlook]
Check Schedule
User: What meetings do I have today?
Praxos: Today's meetings:
         • 10:00 AM - Team Sync (30 min)
         • 2:00 PM - Client Review (1 hour)
         • 4:00 PM - Planning Session (45 min)
Find Meeting Times
User: When are all three of us free for 30 minutes this week?
Praxos: Checking availability...
         All free:
         • Wed 2:00 PM - 3:00 PM
         • Thu 10:30 AM - 11:30 AM
         • Fri 3:00 PM - 4:00 PM

OneDrive

File Access
User: Get my presentation from OneDrive
Praxos: Found "Q3_Presentation.pptx" in OneDrive
         Last modified: 2 days ago
         [Open] [Download] [Share]
Upload Files
User: [Sends file] Upload to my OneDrive
Praxos: Uploaded "report.docx" to OneDrive
         Location: Documents/Reports/
         [View in OneDrive]
Share Files
User: Share this file with the marketing team
Praxos: Created share link for "campaign_ideas.xlsx"
         Access: Team can edit
         Link: https://1drv.ms/x/s!Abc...

Teams Integration

Send Channel Messages
User: Post in #general that the deployment is complete
Praxos: Posted to #general in Engineering team:
         "✓ Deployment complete. All systems operational."

Configuration

Environment Variables

# Required
MICROSOFT_CLIENT_ID=your-app-id
MICROSOFT_CLIENT_SECRET=your-secret
MICROSOFT_TENANT_ID=your-tenant-id

# Optional
MICROSOFT_REDIRECT_URI=https://your-domain.com/auth/microsoft/callback
MICROSOFT_AUTHORITY=https://login.microsoftonline.com
MICROSOFT_SCOPES=Mail.ReadWrite,Calendars.ReadWrite,Files.ReadWrite.All

Graph API Settings

# Default settings
GRAPH_API_ENDPOINT = "https://graph.microsoft.com/v1.0"
MAX_RESULTS_PER_PAGE = 50
REQUEST_TIMEOUT = 30  # seconds

Advanced Features

Batch Requests

For efficiency, batch multiple requests:
# Example: Get calendar + emails + files in one request
batch_response = await graph.batch([
    get_calendar_events(),
    get_recent_emails(),
    get_recent_files()
])

Delta Queries

Track changes efficiently:
# Only get changes since last sync
delta_emails = await graph.get_delta('messages', last_delta_token)

Webhooks

Real-time notifications for:
  • New emails
  • Calendar changes
  • File updates

Troubleshooting

Authentication Issues

Invalid Client
  • Verify Client ID and Secret
  • Check Application ID in Azure Portal
  • Ensure secret hasn’t expired
Insufficient Permissions
  • Check required API permissions granted
  • Admin consent may be required
  • Verify user has necessary licenses

API Errors

403 Forbidden
  • User lacks permissions
  • Application lacks API permissions
  • Tenant admin hasn’t consented
429 Too Many Requests
  • Rate limit exceeded
  • Implement backoff strategy
  • Review request patterns
5xx Server Errors

Rate Limits

Microsoft Graph throttling limits:
ResourceLimit
Mail10K requests/10 min
Calendar10K requests/10 min
Files10K requests/10 min
Batch4 requests/second
Praxos automatically handles throttling with retry logic and exponential backoff.

Security

Token Security

  • Tokens encrypted at rest
  • Automatic token refresh
  • Secure credential storage
  • Per-user isolation

Conditional Access

Support for:
  • Multi-factor authentication
  • Conditional Access policies
  • Device compliance requirements

Compliance

  • GDPR compliant
  • SOC 2 considerations
  • Data residency options
  • Audit logging

Best Practices

  • Use batch requests when possible
  • Implement delta queries for sync
  • Cache frequently accessed data
  • Monitor API usage and throttling
  • Use webhooks for real-time updates

Next Steps