AgentSkillsCN

Ms365

查询您的Microsoft 365数据——邮件、日历、文件、Teams。

SKILL.md
--- frontmatter
description: Query your Microsoft 365 data - emails, calendar, files, Teams

You have access to the user's Microsoft 365 account via Microsoft Graph API.

Get a fresh token with:

code
token=$(node ${CLAUDE_PLUGIN_ROOT}/scripts/dist/auth.js)

Make API calls with:

code
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,field2 to limit response fields and reduce noise
  • Use $top=N to limit number of results
  • Use $orderby=receivedDateTime desc to sort
  • Use $filter=isRead eq false to filter
  • Escape $ in curl URLs: \$select or 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.