skills/msgraph-sdk/SKILL.md
Integrate Microsoft Graph SDK into any project — .NET, TypeScript/JavaScript, or Python. Covers auth patterns (client credentials, OBO, managed identity), SDK setup, calling Graph APIs, batching, delta queries, change notifications, throttling, and permission scopes. Use when accessing Microsoft 365 data (users, mail, calendar, Teams, files, SharePoint) from any application type.
npx skillsauth add williamlimasilva/.copilot msgraph-sdkInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when integrating Microsoft Graph into an application to access Microsoft 365 data and services.
Always ground implementation in the current Microsoft Graph SDK documentation and SDK version for the target language rather than relying on memory alone.
.cs, .csproj, or .sln files, or when the user asks for C# guidance. Follow references/dotnet.md.package.json, .ts, or .js files, or when the user asks for Node.js / browser guidance. Follow references/typescript.md..py, pyproject.toml, or requirements.txt, or when the user asks for Python guidance. Follow references/python.md.Selecting the wrong auth flow is the most common Graph integration mistake. Apply this decision tree before writing any auth code:
| Scenario | Flow to use | |---|---| | Background service / daemon with no user | Client credentials (app-only) | | Agent or API acting on behalf of a signed-in user | On-Behalf-Of (OBO) | | App running in Azure (Function, Container App, VM) | Managed Identity (preferred over secrets) | | CLI tool or local dev script | Device code or interactive browser | | Single-page app (browser only) | Authorization code + PKCE |
DefaultAzureCredential in Azure-hosted apps; it tries managed identity first and falls back gracefully for local dev.Always construct GraphServiceClient once and reuse it (it manages token caching internally).
Pass a credential from the Azure Identity library — never build raw HTTP clients manually.
client.Users[userId].Messages.GetAsync(...).await async calls.$select to limit returned fields — Graph returns large default payloads.$filter server-side rather than filtering returned collections in memory.$expand to fetch related resources in a single call when relationships are small.Graph paginates collections. Never assume all items arrive in one response:
@odata.nextLink on the response.PageIterator helper (available in all three SDKs) to walk pages automatically.$top to control page size (max varies by resource, typically 999).Combine up to 20 independent Graph calls into a single HTTP request using the $batch endpoint. Use batching when:
Batch responses arrive out of order — match them by the id field you assigned each request.
Use delta queries to sync changes incrementally instead of polling full collections:
GET /users/delta returns all items + a @odata.deltaLink.deltaLink to receive only what changed since the last sync.deltaLink durably (database, blob) between sync runs.Subscribe to resource changes with POST /subscriptions:
expirationDateTime (max varies by resource; typically 1–3 days for mail/calendar, up to 4230 minutes for users/groups).validationToken query parameter on creation — echo it back as plain text with HTTP 200.notificationUrl + lifecycleNotificationUrl) to handle missed events and reauthorization.Graph throttles aggressively. Always handle HTTP 429:
Retry-After header — it specifies exact seconds to wait, not a fixed backoff.Get permissions right before writing auth code — wrong scopes result in 403 errors that are hard to debug later.
| Goal | Resource path |
|---|---|
| Get signed-in user's profile | GET /me |
| List user's mailbox messages | GET /me/messages |
| Send an email | POST /me/sendMail |
| List calendar events | GET /me/events |
| Get user's OneDrive root | GET /me/drive/root/children |
| List Teams the user is in | GET /me/joinedTeams |
| Post a Teams channel message | POST /teams/{id}/channels/{id}/messages |
| List SharePoint site lists | GET /sites/{siteId}/lists |
| Search across M365 | POST /search/query |
| List all users in tenant (app-only) | GET /users |
| Get group members | GET /groups/{id}/members |
In similar fashion, use the SDK's fluent API to navigate to these resources in code.
GraphServiceClient is constructed once and reused.Retry-After logic.tools
Create a new workshop or use an existing directory as one. Handles two paths: (A) use an existing local directory the operator points at, or (B) create a new private GitHub repo in the signed-in account. Never creates a repo inside another repo.
development
Guide for setting up vcpkg in C++ projects, managing dependency versions, and cross-compiling. Covers manifest initialization, CMake and Visual Studio integration, classic-to-manifest migration, version pinning, baselines, overrides, triplets, and cross-compilation. Use when a user is working with vcpkg project setup, installation, version management, or cross-platform builds. For specialized tasks, additional references cover custom registries and overlay ports (references/registries.md), CI/CD and binary caching (references/ci.md), and troubleshooting and dependency lifecycle (references/troubleshooting.md).
testing
Emit structured agent signals — hands-up, blocked, done, checkpoint, partnership. Signals are written as JSON to .signals/ for dashboard consumption and noted in the journal for persistence.
development
Install and configure Markstream streaming Markdown renderers for Vue, React, Svelte, Angular, Nuxt, and Vue 2 applications. Use for package selection, minimal peer dependencies, CSS order, SSR boundaries, streaming mode, and renderer setup.