What is Microsoft Graph .NET SDK?
Microsoft Graph .NET SDK is a client library that simplifies calling Microsoft Graph API from .NET applications. It handles authentication, request building, serialization, and error handling, allowing you to focus on building great applications rather than dealing with low-level HTTP details. The SDK provides:- Type-safe API access - Strongly typed models for all Microsoft Graph resources
- Fluent request builders - Intuitive API that mirrors the Microsoft Graph REST endpoints
- Modern authentication - Native support for Azure.Identity TokenCredential classes
- Automatic serialization - JSON serialization/deserialization handled automatically
- Error handling - Comprehensive exception handling for service errors
- Paging support - Built-in support for large result sets and pagination
Why Use the .NET SDK?
Productivity
Write less code with fluent APIs and strongly-typed models. Get IntelliSense support in your IDE for faster development.
Modern Architecture
Built with Kiota code generation for consistency, performance, and modern .NET features including async/await patterns.
Comprehensive Coverage
Access the full Microsoft Graph API surface including users, groups, mail, calendars, files, Teams, and hundreds of other endpoints.
Enterprise Ready
Production-tested library used by thousands of applications with regular updates and comprehensive error handling.
Key Capabilities
Access Microsoft 365 Data
Query and manipulate data across Microsoft 365 services:- Users and Groups - Manage Azure AD users, groups, and organizational structures
- Email and Calendars - Read, send, and manage Outlook email and calendar events
- Files and Documents - Access OneDrive and SharePoint files with rich metadata
- Teams and Collaboration - Interact with Microsoft Teams channels, chats, and meetings
- Security and Compliance - Access security alerts, policies, and compliance data
Unified API Surface
Access multiple Microsoft services through a single, consistent API:Flexible Authentication
Support for multiple authentication flows through Azure.Identity:- Interactive browser authentication for user sign-in
- Client credentials for service-to-service scenarios
- Device code flow for devices with limited input
- Username/password for legacy scenarios
- Certificate-based authentication for enhanced security
Current Version: v5.x
The SDK is currently at version 5.103.0 and uses Kiota for code generation, bringing significant improvements in performance, consistency, and developer experience.
What’s New in v5
The latest major version includes several architectural improvements:- Kiota-based generation - Modern code generator for better consistency
- Namespace organization - Types organized by usage rather than a flat structure
- Simplified API - Removed
Request()method from fluent chains - Backing store support - Efficient change tracking for PATCH operations
- OData cast support - Type-specific collection filtering built into request builders
- Enhanced $count support - First-class support for count operations
If you’re upgrading from v4.x, see the upgrade guide for detailed migration instructions.
Target Framework Support
The Microsoft Graph .NET SDK targets multiple .NET versions to support a wide range of applications:- .NET Standard 2.0 - Compatible with .NET Framework 4.6.1+ and .NET Core 2.0+
- .NET Standard 2.1 - Enhanced performance for .NET Core 3.0+
- .NET 5.0+ - Full support for modern .NET including .NET 6, 7, and 8
- ASP.NET Core web applications
- Console applications
- Windows desktop applications (WPF, WinForms)
- Azure Functions
- Blazor applications
- Xamarin mobile applications
- Unity game development
Architecture Overview
The SDK consists of six major components working together:Authentication Provider
Handles token acquisition and request authentication using Azure.Identity credentials.
Quick Example
Here’s a taste of what working with the SDK looks like:Package Dependencies
The SDK has minimal external dependencies:- Microsoft.Graph.Core (v3.x) - Core abstractions and HTTP middleware
- Azure.Identity (optional) - For TokenCredential-based authentication
- System.Text.Json - For JSON serialization (built into .NET)
Community and Support
The Microsoft Graph .NET SDK is an open-source project with active community support:- GitHub Repository - microsoftgraph/msgraph-sdk-dotnet
- NuGet Package - Microsoft.Graph
- Issue Tracking - Report bugs and request features on GitHub
- API Documentation - Microsoft Graph API Reference
The SDK is updated during the second and fourth week of each month with the latest API changes and improvements.
Next Steps
Installation
Install the SDK and configure your development environment
Quick Start
Build your first Microsoft Graph application in minutes
Authentication
Learn about authentication options and best practices
Core Concepts
Understand request builders, models, and collections
