msgraph-sdk

Integrate Microsoft Graph SDK into .NET, TypeScript, or Python applications for Microsoft 365 data access.

38.5k|4.9k|Updated Jun 11, 2025
One-click install
npx skills add https://github.com/github/awesome-copilot --skill msgraph-sdk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: msgraph-sdk
Source: https://github.com/github/awesome-copilot/tree/main/skills/msgraph-sdk
Command: npx skills add https://github.com/github/awesome-copilot --skill msgraph-sdk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Integrating Microsoft Graph correctly is error-prone: choosing the wrong authentication flow, missing pagination, ignoring throttling, or over-scoping permissions leads to broken or insecure integrations. This Skill guides developers through correct Graph SDK setup and usage patterns across .NET, TypeScript/JavaScript, and Python.

Core Features & Use Cases

  • Language-specific workflows: Detects the project language and loads dedicated references for .NET, TypeScript/JavaScript, or Python with correct packages, client setup, and code patterns.
  • Authentication decision tree: Maps scenarios (daemon, OBO, managed identity, CLI, SPA) to the correct auth flow and credential type.
  • Advanced Graph patterns: Covers batching, delta queries, change notifications, pagination with PageIterator, and 429 throttling handling.
  • Use Case: A developer building a background service that syncs user mailboxes can follow the client credentials setup, implement delta queries for incremental sync, and enable retry middleware — all with least-privilege permissions.

Quick Start

Ask the assistant to integrate Microsoft Graph into your project to read the signed-in user's messages, and it will detect your language and produce the correct SDK setup and code.

Frequently Asked Questions about msgraph-sdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I authenticate with Microsoft Graph SDK?

Choose the flow based on your scenario: client credentials for daemons, On-Behalf-Of for APIs acting as a signed-in user, managed identity for Azure-hosted apps, and device code or interactive browser for CLI tools. Pass the matching Azure Identity credential to GraphServiceClient.

How do I handle pagination in Microsoft Graph API responses?

Graph paginates collections and returns an @odata.nextLink when more pages exist. Use the SDK's PageIterator helper, available in the .NET, TypeScript, and Python SDKs, to walk all pages automatically instead of assuming a single response.

Which Microsoft Graph SDK should I use for Python?

Install the msgraph-sdk package together with azure-identity. The Python SDK is async-first, so use the azure.identity.aio credential variants and run calls inside an asyncio context or an async framework like FastAPI.

Why does Microsoft Graph return HTTP 429 throttling errors?

Graph throttles aggressive request patterns and returns 429 with a Retry-After header specifying exact wait seconds. Enable the SDK's built-in retry middleware and avoid large parallel fan-outs; use batching or queuing instead of fixed backoff.

What is the difference between application and delegated Graph permissions?

Application permissions run without a signed-in user and suit daemons, requiring admin consent. Delegated permissions run in a signed-in user's context. Always request the minimum scopes needed and verify requirements in the Graph permissions reference.

How do I sync Microsoft 365 data changes incrementally?

Use delta queries: the first call to an endpoint like /users/delta returns all items plus a deltaLink, and subsequent calls with that link return only changes. Store the deltaLink durably between sync runs.