Install the Microsoft Graph SDKs

The Microsoft Graph SDKs are available to be included in your projects via GitHub and popular platform package managers. This topic describes how you can install the Microsoft Graph SDK into your project.

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.
  • Microsoft.Graph.Auth - Provides an authentication scenario-based wrapper of the Microsoft Authentication Library (MSAL) for use with the Microsoft Graph SDK. Microsoft.Graph.Auth has a dependency on Microsoft.Graph.Core.

You can use either the Package Manager UI in Visual Studio or the Package Manager Console to install the Microsoft.Graph packages into your project. The following Package Manager Console commands will install the Microsoft.Graph, Microsoft.Graph.Core, and Microsoft.Graph.Auth libraries. Microsoft.Graph.Core is installed as a dependency of Microsoft.Graph.

Install-Package Microsoft.Graph
Install-Package Microsoft.Graph.Auth -IncludePrerelease

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-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.

Install the Microsoft Graph Java SDK via Gradle

Add the repository and a compile dependency for microsoft-graph to your project's build.gradle:

repository {
    jcenter()
}

dependency {
    // Include the sdk as a dependency
    compile('com.microsoft.graph:microsoft-graph:1.2.+')
}

Install the Microsoft Graph Java SDK via Maven

Add the dependency in the dependencies element in pom.xml:

<dependency>
	<groupId>com.microsoft.graph</groupId>
	<artifactId>microsoft-graph</artifactId>
	<version>1.2.0</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.

You can use npm to install the Microsoft Graph Javascript SDK:

npm install @microsoft/microsoft-graph-client
npm install @microsoft/microsoft-graph-types --save-dev

Install the Microsoft Graph Objective-C SDK

The Microsoft Graph Objective-C SDK supports both iOS and macOS platforms and can be installed into your project using either CocoaPods or Carthage.

Install the Microsoft Graph Objective-C SDK using Cocoapods

Add the following line in your podfile to include the Objective-C Microsoft Graph SDK and Microsoft Graph Objective-C Auth SDK in your xcode project:

pod 'MSGraphClientSDK'
pod 'MSGraphMSALAuthProvider'

Install the Microsoft Graph Objective-C SDK using Carthage

Perform the following steps to install the Microsoft Graph Objective-C SDK and Microsoft Graph Objective-C Auth SDK using the Carthage package manager.

  1. Create a Cartfile that specifies the Objective-C SDK GitHub repository and release tag to target.
github "microsoftgraph/msgraph-sdk-objc" "tags/<latest_release_tag>"
github "microsoftgraph/msgraph-sdk-objc-auth" "tags/<latest_release_tag>"
  1. Run carthage update. This will fetch dependencies into a Carthage/Checkouts folder and then builds the MSGraphClientSDK library.

  2. Using Xcode, in your application target's General settings tab, in the Linked Frameworks and Libraries section, drag and drop the MSGraphClientSDK.framework and MSGraphMSALAuthProvider.framework from the Carthage/Build folder on disk.

  3. On your application target's Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a run script in which you specify your shell (ex: /bin/sh), and add the following contents to the script:

/usr/local/bin/carthage copy-frameworks
  1. Add the paths to the frameworks you want to use under Input Files.
$(SRCROOT)/Carthage/Build/iOS/MSGraphClientSDK.framework
$(SRCROOT)/Carthage/Build/iOS/MSGraphMSALAuthProvider.framework

Install the Microsoft Graph PHP SDK

The Microsoft Graph PHP SDK is available from packagist.org and can be installed in the following ways:

Install the Microsoft Graph PHP SDK manually using composer

composer require microsoft/microsoft-graph

Install the Microsoft Graph PHP SDK using composer.json

{
    "require": {
        "microsoft/microsoft-graph": "^1.8"
    }
}

Install the Microsoft Graph Ruby SDK

The Microsoft Graph Ruby SDK is available from rubygems.org and can be installed using the following command:

gem install microsoft_graph