Install a Microsoft Graph SDK

Microsoft Graph SDKs are available to be included in your projects via GitHub and popular platform package managers. This article describes how you can 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 either the Package Manager UI in Visual Studio or the Package Manager Console. The following Package Manager Console commands install the Microsoft.Graph and Microsoft.Graph.Core libraries. Microsoft.Graph.Core is installed as a dependency of Microsoft.Graph.

Install-Package Microsoft.Graph

Install the Microsoft Graph Go SDK (preview)

Important

The Microsoft Graph SDK for Go is currently in preview. Use of this SDK in production is not supported.

The Microsoft Graph Go SDK is included in the following packages:

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.
  • microsoft-graph-auth: Provides an authentication scenario-based wrapper of Microsoft Authentication Library (MSAL) for use with the Microsoft Graph SDK.

To install the Microsoft Graph Java SDK, do one of the following:

  • 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:5.+'
          // 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>[5.0,)</version>
      </dependency>
      <dependency>
          <groupId>com.azure</groupId>
          <artifactId>azure-identity</artifactId>
          <version>[1.3,)</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": "^1.8"
        }
    }
    

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 (preview)

Important

The Microsoft Graph SDK for Python is currently in preview. Use of this SDK in production is not supported.

The Microsoft Graph Python SDK (preview) is available on PyPI.

pip install msgraph-sdk

See also