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-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.
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()
jcenter{
url 'https://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
dependency {
// Include the sdk as a dependency
implementation 'com.microsoft.graph:microsoft-graph:2.+'
implementation 'com.microsoft.graph:microsoft-graph-auth:0.3.0'
}
Install the Microsoft Graph Java SDK via Maven
Add the repositories in the profiles
element in pom.xml:
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>bintray-microsoftgraph-Maven</id>
<name>bintray</name>
<url>https://dl.bintray.com/microsoftgraph/Maven</url>
</repository>
</repositories>
</profile>
<profile>
<id>allow-snapshots</id>
<activation><activeByDefault>true</activeByDefault></activation>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
Add the dependency in the dependencies
element in pom.xml:
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph</artifactId>
<version>[2.0,)</version>
</dependency>
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph-auth</artifactId>
<version>0.3.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 --save
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.
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>"
Run
carthage update
. This will fetch dependencies into a Carthage/Checkouts folder and then builds the MSGraphClientSDK library.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.
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
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 PowerShell SDK
See Install the Microsoft Graph PowerShell SDK.
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