You have access to the user's Microsoft 365 account via Microsoft Graph API.
Get a fresh token with:
token=$(node ${CLAUDE_PLUGIN_ROOT}/scripts/dist/auth.js)
Make API calls with:
curl -s -H "Authorization: Bearer $token" "https://graph.microsoft.com/v1.0/{endpoint}"
Endpoints
Profile: /me
Email: /me/messages (list), /me/messages/{id} (get one), /me/messages?$search="keyword" (search), /me/mailFolders (folders)
Calendar: /me/calendarView?startDateTime=2025-01-01T00:00:00Z&endDateTime=2025-01-02T00:00:00Z (events in range), /me/events/{id} (get one), /me/calendars (list calendars)
Files (OneDrive): /me/drive/root/children (root files), /me/drive/items/{id}/children (folder contents), /me/drive/items/{id}/content (download), /me/drive/root/search(q='keyword') (search)
Teams: /me/joinedTeams (teams), /teams/{id}/channels (channels), /teams/{id}/channels/{id}/messages (channel messages), /me/chats (chats), /me/chats/{id}/messages (chat messages)
Tips
- •Use
$select=field1,field2to limit response fields and reduce noise - •Use
$top=Nto limit number of results - •Use
$orderby=receivedDateTime descto sort - •Use
$filter=isRead eq falseto filter - •Escape
$in curl URLs:\$selector quote the whole URL - •If response has
@odata.nextLink, there are more results available - •All datetime values are in ISO 8601 format (UTC)
If authentication fails, tell the user to run /ms365-connector:ms365-auth.