Install a Microsoft Graph SDK
Microsoft Graph SDKs can be included in your projects via GitHub and popular platform package managers. This article describes how to install a Microsoft Graph SDK into your project.
SDKs are available in the following languages:
Install the Microsoft Graph .NET SDK
The Microsoft Graph .NET SDK is included in the following NuGet packages:
- Microsoft.Graph: Contains the models and request builders for accessing the
v1.0
endpoint with the fluent API. Microsoft.Graph has a dependency on Microsoft.Graph.Core. - Microsoft.Graph.Beta: Contains the models and request builders for accessing the
beta
endpoint with the fluent API. Microsoft.Graph.Beta has a dependency on Microsoft.Graph.Core. - Microsoft.Graph.Core: The core library for making calls to Microsoft Graph.
To install the Microsoft.Graph packages into your project, you can use the dotnet CLI, the Package Manager UI in Visual Studio or the Package Manager Console in Visual Studio. The following commands install the Microsoft.Graph and Microsoft.Graph.Core libraries. Microsoft.Graph.Core is installed as a dependency of Microsoft.Graph.
dotnet CLI
dotnet add package Microsoft.Graph
Package Manager Console
Install-Package Microsoft.Graph
Install the Microsoft Graph Go SDK
The Microsoft Graph Go SDK is included in the following packages:
- Microsoft Graph SDK for Go: Contains the models and request builders for accessing the
v1.0
endpoint with the fluent API. - Microsoft Graph Beta SDK for Go: Contains the models and request builders for accessing the
beta
endpoint with the fluent API. - Microsoft Graph Core SDK for Go: The core library for making calls to Microsoft Graph.
go get github.com/microsoftgraph/msgraph-sdk-go
go get github.com/Azure/azure-sdk-for-go/sdk/azidentity
Install the Microsoft Graph Java SDK
The Microsoft Graph Java SDK is included in the following packages:
- microsoft-graph: Contains the models and request builders for accessing the
v1.0
endpoint with the fluent API. - microsoft-graph-beta: Contains the models and request builders for accessing the
beta
endpoint with the fluent API. - microsoft-graph-core: The core library for making calls to Microsoft Graph.
To install the Microsoft Graph Java SDK, you can use one of these two options:
Use Gradle to install the Microsoft Graph Java SDK. Add the repository and a compile dependency for microsoft-graph to your project's build.gradle:
repository { mavenCentral() } dependency { // Include the sdk as a dependency implementation 'com.microsoft.graph:microsoft-graph:6.+' // Beta implementation 'com.microsoft.graph:microsoft-graph-beta:6.+' // Include Azure identity for authentication implementation 'com.azure:azure-identity:1.+' }
Use Maven to install the Microsoft Graph Java SDK. Add the dependency in the
dependencies
element in pom.xml:<dependency> <groupId>com.microsoft.graph</groupId> <artifactId>microsoft-graph</artifactId> <version>[6.0,)</version> </dependency> <dependency> <groupId>com.microsoft.graph</groupId> <artifactId>microsoft-graph-beta</artifactId> <version>[6.0,)</version> </dependency> <dependency> <groupId>com.azure</groupId> <artifactId>azure-identity</artifactId> <version>[1.11,)</version> </dependency>
Install the Microsoft Graph JavaScript SDK
The Microsoft Graph JavaScript SDK is included in the following packages:
- @microsoft/microsoft-graph-client (npm): The core library for making calls to Microsoft Graph.
- @microsoft/microsoft-graph-types (npm): The TypeScript types for the Microsoft Graph entities.
Use npm to install the Microsoft Graph JavaScript SDK:
npm install @microsoft/microsoft-graph-client --save
npm install @microsoft/microsoft-graph-types --save-dev
Install the Microsoft Graph PHP SDK
The Microsoft Graph PHP SDK is available from packagist.org and can be installed in the following ways:
Use composer to install the Microsoft Graph PHP SDK manually:
composer require microsoft/microsoft-graph
Use composer.json to install the Microsoft Graph PHP SDK:
{ "require": { "microsoft/microsoft-graph": "^2.0.0" } }
Install the Microsoft Graph PowerShell SDK
All the modules are published on PowerShell Gallery. To install:
Install-Module Microsoft.Graph
If you're upgrading from the preview modules, run Install-Module
with AllowClobber
and Force
parameters to avoid command name conflicts:
Install-Module Microsoft.Graph -AllowClobber -Force
Install the Microsoft Graph Python SDK
The Microsoft Graph Python SDK is available on PyPI.
pip install msgraph-sdk
Related content
- For more information, see the SDK design requirements documentation.
- For a list of samples for Microsoft Graph, see the Microsoft Graph resources page.
- For step-by-step training for creating a Microsoft Graph app, see the Microsoft Graph tutorials.