SDKs overview
Microsoft Graph API offers a comprehensive set of Software Development Kits (SDKs) designed to simplify interaction with its various services, including Microsoft 365, Windows 10, and Enterprise Mobility + Security. These SDKs abstract the underlying RESTful API calls, handling common tasks such as authentication token management, request construction, response parsing, and error handling. This approach allows developers to focus on application logic rather than the intricacies of HTTP requests and JSON serialization.
The SDKs are available for multiple programming languages, providing idiomatic access to the Microsoft Graph API. Each SDK typically includes client libraries, models for API resources (like users, messages, and files), and utility functions. By utilizing an SDK, developers can reduce boilerplate code, improve developer productivity, and minimize the potential for common API-related errors. Microsoft maintains these official SDKs, ensuring they are kept up-to-date with the latest API versions and features, as detailed in the Microsoft Graph SDK overview.
Official SDKs by language
Microsoft provides and actively maintains official SDKs for a range of popular programming languages. These SDKs are designed to offer a consistent and developer-friendly experience across different platforms. The table below outlines the primary official SDKs, their package names, common installation methods, and their general maturity level as of 2026. For detailed release notes and specific versioning, consult the Microsoft Graph SDK documentation.
| Language | Package Name | Installation Command | Maturity |
|---|---|---|---|
| .NET (C#, F#, VB.NET) | Microsoft.Graph |
dotnet add package Microsoft.Graph |
Stable, actively developed |
| Java | microsoft-graph |
Gradle: implementation 'com.microsoft.graph:microsoft-graph:X.Y.Z'Maven: <dependency><groupId>com.microsoft.graph</groupId><artifactId>microsoft-graph</artifactId><version>X.Y.Z</version></dependency> |
Stable, actively developed |
| JavaScript | @microsoft/microsoft-graph-client |
npm install @microsoft/microsoft-graph-client |
Stable, actively developed |
| Go | github.com/microsoftgraph/msgraph-sdk-go |
go get github.com/microsoftgraph/msgraph-sdk-go |
Stable, actively developed |
| PHP | microsoft/microsoft-graph |
composer require microsoft/microsoft-graph |
Stable, actively developed |
| PowerShell | Microsoft.Graph |
Install-Module Microsoft.Graph |
Stable, actively developed |
| Python | msgraph-sdk |
pip install msgraph-sdk |
Stable, actively developed |
| Ruby | microsoft_graph |
gem install microsoft_graph |
Stable, actively developed |
Installation
Installing a Microsoft Graph API SDK typically involves using the package manager specific to the chosen programming language. The following subsections provide general installation instructions for key SDKs.
.NET SDK Installation
The .NET SDK can be installed via the NuGet package manager. Open your project's command line or PowerShell terminal and run:
dotnet add package Microsoft.Graph
This command adds the Microsoft.Graph package to your .NET project, making the client library and associated models available for use. You can find more detailed .NET installation guidance in the Microsoft Graph .NET SDK documentation.
Java SDK Installation
For Java projects, the SDK is available through Maven Central. Add the following dependency to your pom.xml for Maven, or to your build.gradle for Gradle:
Maven:
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph</artifactId≯
<version>X.Y.Z</version> <!-- Replace X.Y.Z with the latest version -->
</dependency>
Gradle:
implementation 'com.microsoft.graph:microsoft-graph:X.Y.Z' // Replace X.Y.Z with the latest version
Consult the Microsoft Graph Java SDK setup guide for the latest version number and further details.
JavaScript SDK Installation
The JavaScript SDK is distributed as an npm package. To install it in your Node.js or front-end JavaScript project, use npm or yarn:
npm install @microsoft/microsoft-graph-client
or
yarn add @microsoft/microsoft-graph-client
This installs the core client library. Additional packages for authentication helpers might also be needed depending on your application's authentication flow, as described in the Microsoft Graph JavaScript SDK documentation.
Python SDK Installation
For Python developers, the SDK can be installed using pip:
pip install msgraph-sdk
This command installs the msgraph-sdk package, providing access to the Python client library for Microsoft Graph. More information, including authentication examples, is available in the Microsoft Graph Python SDK quickstart.
Quickstart example
This example demonstrates how to fetch the currently signed-in user's profile using the JavaScript SDK. This quickstart assumes you have already obtained an access token, for example, using MSAL.js (Microsoft Authentication Library for JavaScript), which handles the OAuth 2.0 flow. Integrating with Microsoft Graph API often involves OAuth 2.0 for secure authorization, a standard for delegating access without sharing credentials, as described by OAuth.net.
First, ensure you have installed the JavaScript SDK:
npm install @microsoft/microsoft-graph-client
Then, initialize the Graph client and make a request:
// Import the Graph client
import { Client } from '@microsoft/microsoft-graph-client';
// Assuming you have an access token (e.g., from MSAL.js)
const accessToken = 'YOUR_ACCESS_TOKEN'; // Replace with a valid access token
// Create a Graph client instance
const client = Client.init({
authProvider: (done) => {
done(null, accessToken);
}
});
async function getUserProfile() {
try {
// Get the user's profile
const user = await client.api('/me')
.select('displayName,mail,userPrincipalName') // Select specific properties
.get();
console.log('User Display Name:', user.displayName);
console.log('User Email:', user.mail || user.userPrincipalName);
} catch (error) {
console.error('Error fetching user profile:', error);
}
}
getUserProfile();
In this example:
Client.initinitializes the Graph client, providing anauthProviderfunction that supplies the access token.client.api('/me')targets the/meendpoint, representing the currently authenticated user..select('displayName,mail,userPrincipalName')specifies which user properties to retrieve, optimizing the request..get()executes the GET request to the Microsoft Graph API.
This basic structure can be extended for other operations like sending emails, managing files, or creating calendar events, by modifying the endpoint and HTTP method (e.g., .post(), .patch(), .delete()).
Community libraries
Beyond the official SDKs, the Microsoft Graph API ecosystem benefits from various community-contributed libraries and tools. These resources often fill specific niches, provide alternative implementations, or offer higher-level abstractions for particular scenarios:
- Power Automate (formerly Microsoft Flow) Connectors: While not a traditional library, Power Automate offers a no-code/low-code way to interact with Microsoft Graph through its built-in connectors, enabling automation of workflows across Microsoft services. This is especially relevant for business users and citizen developers.
- Microsoft Graph Toolkit: This is a collection of web components and providers that simplify connecting to and working with Microsoft Graph. It allows developers to quickly integrate Microsoft Graph data into their web applications using pre-built UI components, reducing the need for direct SDK calls for common scenarios like user profiles or calendar views. Although developed by Microsoft, its open-source nature and focus on reusable UI components often position it as a community-driven extension. More information is available on the Microsoft Graph Toolkit overview page.
- Third-party authentication libraries: While Microsoft provides MSAL (Microsoft Authentication Library), some developers might opt for other OAuth 2.0 client libraries in their chosen language, integrating them with the Graph SDK. An example of a robust, general-purpose OAuth 2.0 client library for Python is
requests-oauthlib, which can be adapted to acquire tokens for Microsoft Graph. - GraphQL proxies/wrappers: Some community projects have explored creating GraphQL wrappers over the Microsoft Graph REST API, offering an alternative query language interface for specific use cases. These are typically experimental and not officially supported, but demonstrate the flexibility of the Graph API.
Developers considering community libraries should evaluate their maintenance status, documentation, and compatibility with the latest Graph API versions, as these may vary more than with official SDKs.