See the version list below for details.
dotnet add package Microsoft.Graph.Core --version 1.10.0
NuGet\Install-Package Microsoft.Graph.Core -Version 1.10.0
<PackageReference Include="Microsoft.Graph.Core" Version="1.10.0" />
paket add Microsoft.Graph.Core --version 1.10.0
#r "nuget: Microsoft.Graph.Core, 1.10.0"
// Install Microsoft.Graph.Core as a Cake Addin #addin nuget:?package=Microsoft.Graph.Core&version=1.10.0 // Install Microsoft.Graph.Core as a Cake Tool #tool nuget:?package=Microsoft.Graph.Core&version=1.10.0
Microsoft Graph .NET Client Library
Integrate the Microsoft Graph API into your .NET project!
The Microsoft Graph .NET Client Library targets .NetStandard 1.1 and .Net Framework 4.5.
Installation via NuGet
To install the client library via NuGet:
- Search for
Microsoft.Graphin the NuGet Library, or
Install-Package Microsoft.Graphinto the Package Manager Console.
1. Register your application
Register your application to use Microsoft Graph API using one of the following supported authentication portals:
- Microsoft Application Registration Portal: Register a new application that works with Microsoft Account and/or organizational accounts using the unified V2 Authentication Endpoint.
- Microsoft Azure Active Directory: Register a new application in your tenant's Active Directory to support work or school users for your tenant or multiple tenants.
2. Authenticate for the Microsoft Graph service
The Microsoft Graph .NET Client Library does not include any default authentication implementations.
Instead, the user will want to authenticate with the library of their choice, or against the OAuth
endpoint directly, and built-in DelegateAuthenticationProvider class to authenticate each request.
For more information on
DelegateAuthenticationProvider, see the library overview
The recommended library for authenticating against AAD is ADAL.
For an example of authenticating a UWP app using the V2 Authentication Endpoint, see the Microsoft Graph UWP Connect Library.
3. Create a Microsoft Graph client object with an authentication provider
An instance of the GraphServiceClient class handles building requests,
sending them to Microsoft Graph API, and processing the responses. To create a
new instance of this class, you need to provide an instance of
IAuthenticationProvider which can authenticate requests to Microsoft Graph.
For more information on initializing a client instance, see the library overview
4. Make requests to the graph
Once you have completed authentication and have a GraphServiceClient, you can begin to make calls to the service. The requests in the SDK follow the format of the Microsoft Graph API's RESTful syntax.
For example, to retrieve a user's default drive:
var drive = await graphClient.Me.Drive.Request().GetAsync();
GetAsync will return a
Drive object on success and throw a
ServiceException on error.
To get the current user's root folder of their default drive:
var rootItem = await graphClient.Me.Drive.Root.Request().GetAsync();
GetAsync will return a
DriveItem object on success and throw a
ServiceException on error.
For a general overview of how the SDK is designed, see overview.
The following sample applications are also available:
- Microsoft Graph UWP Connect Sample
- Microsoft Graph UWP Snippets Sample
- Microsoft Graph MeetingBot sample for UWP
- Microsoft Graph Connect Sample for ASP.NET 4.6
- Microsoft Graph Snippets Sample for ASP.NET 4.6
- Microsoft Graph SDK Snippets Library for Xamarin.Forms
- Microsoft Graph Connect Sample for Xamarin Forms
- Microsoft Graph Meeting Manager Sample for Xamarin.Forms
- Microsoft Graph Property Manager Sample for Xamarin Native
Documentation and resources
Install NewtonSoft.Json first if you want to use a version greater than NewtonSoft.Json 6.0.1. For example, you'll need to install NewtonSoft.Json 9.0.1 first if you want to use this to library while targeting .Net Core with standard1.0.
Install System.Runtime.InteropServices.RuntimeInformation before you install Microsoft.Graph >=1.3 if you are having an issue updating the package for a Xamarin solution. You may need to updated references to Microsoft.NETCore.UniversalWindowsPlatform to >=5.2.2 as well.
To view or log issues, see issues.
- NuGet Package: https://www.nuget.org/packages/Microsoft.Graph
Building library locally
If you are looking to build the library locally for the purposes of contributing code or running tests, you will need to:
- Have the .NET Core SDK (> 1.0) installed
dotnet restorefrom the command line in your package directory
msbuildfrom CLI or run Build from Visual Studio to restore Nuget packages and build the project
|Product||Versions Compatible and additional computed target framework versions.|
|.NET||net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed.|
|.NET Core||netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed.|
|.NET Standard||netstandard1.1 is compatible. netstandard1.2 was computed. netstandard1.3 was computed. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 was computed. netstandard2.1 was computed.|
|.NET Framework||net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed.|
|MonoAndroid||monoandroid was computed.|
|MonoMac||monomac was computed.|
|MonoTouch||monotouch was computed.|
|Tizen||tizen30 was computed. tizen40 was computed. tizen60 was computed.|
|Universal Windows Platform||uap was computed. uap10.0 was computed.|
|Windows Phone||wpa81 was computed.|
|Windows Store||netcore was computed. netcore45 was computed. netcore451 was computed.|
|Xamarin.iOS||xamarinios was computed.|
|Xamarin.Mac||xamarinmac was computed.|
|Xamarin.TVOS||xamarintvos was computed.|
|Xamarin.WatchOS||xamarinwatchos was computed.|
NuGet packages (33)
Showing the top 5 NuGet packages that depend on Microsoft.Graph.Core:
Microsoft Graph Client Library allows you to call Office 365, Azure AD and other Microsoft services through a single unified developer experience.
Microsoft Graph Authentication Library implements authentication functionality used by Microsoft Graph Client Library. It provides a set of OAuth scenario-centric providers that implement Microsoft.Graph.IAuthenticationProvider and uses Microsoft Authentication Library (MSAL) to handle access token acquisition and storage.
Microsoft Graph beta client library allows you to target the Microsoft Graph /beta endpoint. You can call Office 365, Azure AD and other Microsoft services through a single unified developer experience.
PnP Framework contains the PnP Provisioning engine and a ton of extension methods that will make you more productive while developing for Microsoft 365.
Microsoft Graph Communications Client Core Library - This library builds on the Microsoft.Graph SDK to provide better support for the Communications APIs.
GitHub repositories (21)
Showing the top 5 popular GitHub repositories that depend on Microsoft.Graph.Core:
Free open source office suite with business productivity tools: document and project management, CRM, mail aggregator.
SharePoint / Office 365 Developer Patterns and Practices - Archived older solutions. Please see https://aka.ms/m365pnp for updated guidance
SharePoint PnP PowerShell CmdLets
A cloud storage provider plugin for KeePass Password Safe
Microsoft Graph Client Library for .NET!
July 2018 Release Summary (version 1.10.0)
- Added the ability to append an arbitrary URL segment to a request. This will support the creation of custom requests.
- Set signing properties in .csproj to be 'false' by default.