Skip to content
All projects
Core engineering libraryEngineer

m365_graph.py — Microsoft Graph Integration Client

BCHPR · Microsoft 365 estate · 2023 – present

5,512-line Microsoft Graph API client covering OAuth authentication, Outlook email, Teams messaging, OneDrive / SharePoint file management, calendar events, and user delegation.

Highlights

  • OAuth 2.0 client-credentials flow with automatic token refresh and disk cache.
  • send_mail, post_teams_message, and calendar create_event / update_event / find_time_slots.
  • OneDrive / SharePoint list / download / upload / move with path → drive-ID caching (lru_cache).
  • Rate-limited (100 ms between calls) with specific exception types (TokenError, FileNotFoundError).
  • Handles 1,000+ file operations per pipeline run; centralises M365 authentication across all projects.