Microsoft.Graph
1.12.0
Prefix Reserved
See the version list below for details.
dotnet add package Microsoft.Graph --version 1.12.0
NuGet\Install-Package Microsoft.Graph -Version 1.12.0
<PackageReference Include="Microsoft.Graph" Version="1.12.0" />
paket add Microsoft.Graph --version 1.12.0
#r "nuget: Microsoft.Graph, 1.12.0"
// Install Microsoft.Graph as a Cake Addin #addin nuget:?package=Microsoft.Graph&version=1.12.0 // Install Microsoft.Graph as a Cake Tool #tool nuget:?package=Microsoft.Graph&version=1.12.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.Graph
in the NuGet Library, or - Type
Install-Package Microsoft.Graph
into the Package Manager Console.
Getting started
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
Notes
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.
Issues
To view or log issues, see issues.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Other resources
- 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
- Run
dotnet restore
from the command line in your package directory - Run
nuget restore
andmsbuild
from CLI or run Build from Visual Studio to restore Nuget packages and build the project
License
Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT license. See Third Party Notices for information on the packages referenced via NuGet.
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-browser 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. |
-
.NETFramework 4.5
- Microsoft.Graph.Core (>= 1.12.0)
- Newtonsoft.Json (>= 6.0.1 && < 12.0.0)
-
.NETStandard 1.1
- Microsoft.Graph.Core (>= 1.12.0)
- NETStandard.Library (>= 1.6.0)
- Newtonsoft.Json (>= 9.0.1)
- System.Net.Http (>= 4.3.3)
NuGet packages (211)
Showing the top 5 NuGet packages that depend on Microsoft.Graph:
Package | Downloads |
---|---|
Microsoft.Identity.Web.MicrosoftGraph
This package enables ASP.NET Core web apps and web APIs to use the Microsoft identity platform (formerly Azure AD v2.0). This package is specifically used for web applications, which sign-in users and call Microsoft Graph, and for protected web APIs that call Microsoft Graph. |
|
GSF.Security
Library of core security framework for implementing role-based security with integrated Active Directory, local account and database style authentication across various .NET application types. |
|
PnP.Framework
PnP Framework contains the PnP Provisioning engine and a ton of extension methods that will make you more productive while developing for Microsoft 365. |
|
SharePointPnPCoreOnline
Retired - please use PnP Framework (https://github.com/pnp/pnpframework) going forward. Core CSOM extension methods for SharePoint Online add-in model development. This will increase productivity of the developers by abstracting complex operations. |
|
Rystem.Content.Infrastructure.M365.Sharepoint
Rystem.Content helps you to integrate with azure services or to create an abstraction layer among your infrastructure and your business. |
GitHub repositories (56)
Showing the top 5 popular GitHub repositories that depend on Microsoft.Graph:
Repository | Stars |
---|---|
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
|
|
unoplatform/uno
Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
|
|
Azure/azure-sdk-for-net
This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
|
|
lukencode/FluentEmail
All in one email sender for .NET. Supports popular senders (SendGrid, MailGun, etc) and Razor templates.
|
|
microsoft/onefuzz
A self-hosted Fuzzing-As-A-Service platform
|
Version | Downloads | Last updated |
---|---|---|
5.63.0 | 6,672 | 11/20/2024 |
5.62.0 | 141,283 | 11/7/2024 |
5.61.0 | 347,169 | 10/17/2024 |
5.60.0 | 434,722 | 10/9/2024 |
5.59.0 | 164,675 | 10/2/2024 |
5.58.0 | 449,703 | 9/12/2024 |
5.57.0 | 156,425 | 9/5/2024 |
5.56.1 | 275,647 | 8/28/2024 |
5.56.0 | 3,938,637 | 6/6/2024 |
5.55.0 | 257,018 | 5/31/2024 |
5.54.0 | 236,815 | 5/24/2024 |
5.53.0 | 334,750 | 5/16/2024 |
5.52.0 | 381,030 | 5/8/2024 |
5.51.0 | 169,640 | 5/2/2024 |
5.50.0 | 262,106 | 4/25/2024 |
5.49.0 | 490,877 | 4/17/2024 |
5.48.0 | 370,221 | 4/9/2024 |
5.47.0 | 140,005 | 4/5/2024 |
5.46.0 | 319,396 | 3/27/2024 |
5.45.0 | 220,302 | 3/22/2024 |
5.44.0 | 1,037,492 | 2/28/2024 |
5.43.0 | 388,585 | 2/21/2024 |
5.42.0 | 308,068 | 2/14/2024 |
5.41.0 | 1,090,055 | 2/1/2024 |
5.40.0 | 828,118 | 1/24/2024 |
5.39.0 | 335,300 | 1/17/2024 |
5.38.0 | 576,528 | 1/4/2024 |
5.37.0 | 461,205 | 12/14/2023 |
5.36.0 | 878,550 | 11/22/2023 |
5.35.0 | 310,166 | 11/16/2023 |
5.34.0 | 273,980 | 11/8/2023 |
5.33.0 | 179,093 | 11/3/2023 |
5.32.0 | 262,979 | 10/26/2023 |
5.31.0 | 282,651 | 10/19/2023 |
5.30.0 | 160,896 | 10/12/2023 |
5.29.0 | 135,656 | 10/6/2023 |
5.28.0 | 412,145 | 9/21/2023 |
5.27.0 | 178,350 | 9/14/2023 |
5.26.0 | 178,620 | 9/6/2023 |
5.25.0 | 187,270 | 8/31/2023 |
5.24.0 | 304,154 | 8/24/2023 |
5.23.0 | 138,687 | 8/18/2023 |
5.22.0 | 279,666 | 8/10/2023 |
5.21.0 | 217,085 | 8/2/2023 |
5.20.0 | 122,034 | 7/27/2023 |
5.19.0 | 192,762 | 7/19/2023 |
5.18.0 | 214,923 | 7/12/2023 |
5.17.0 | 234,309 | 7/5/2023 |
5.16.0 | 170,607 | 6/29/2023 |
5.15.0 | 291,295 | 6/21/2023 |
5.14.0 | 186,566 | 6/15/2023 |
5.13.0 | 236,821 | 6/9/2023 |
5.12.0 | 572,816 | 5/25/2023 |
5.11.0 | 259,715 | 5/17/2023 |
5.10.0 | 210,732 | 5/11/2023 |
5.9.0 | 157,104 | 5/4/2023 |
5.8.0 | 136,222 | 4/28/2023 |
5.7.0 | 193,787 | 4/20/2023 |
5.6.0 | 277,358 | 4/13/2023 |
5.5.0 | 395,772 | 4/6/2023 |
5.4.0 | 185,294 | 3/29/2023 |
5.3.0 | 224,338 | 3/22/2023 |
5.2.0 | 201,543 | 3/15/2023 |
5.1.0 | 151,139 | 3/8/2023 |
5.0.0 | 227,862 | 2/28/2023 |
5.0.0-rc.5 | 9,580 | 2/9/2023 |
5.0.0-rc.4 | 3,551 | 1/27/2023 |
5.0.0-rc.3 | 2,708 | 1/18/2023 |
5.0.0-rc.2 | 1,348 | 1/11/2023 |
5.0.0-rc.1 | 5,718 | 12/16/2022 |
5.0.0-preview.14 | 64,718 | 11/23/2022 |
5.0.0-preview.13 | 35,733 | 10/19/2022 |
5.0.0-preview.12 | 3,258 | 9/28/2022 |
5.0.0-preview.11 | 1,655 | 9/14/2022 |
5.0.0-preview.10 | 72,141 | 7/20/2022 |
5.0.0-preview.9 | 2,309 | 7/13/2022 |
5.0.0-preview.8 | 20,263 | 6/21/2022 |
5.0.0-preview.7 | 1,014 | 6/9/2022 |
5.0.0-preview.6 | 664 | 6/2/2022 |
5.0.0-preview.5 | 4,762 | 5/20/2022 |
5.0.0-preview.4 | 4,626 | 5/6/2022 |
5.0.0-preview.3 | 3,341 | 4/20/2022 |
5.0.0-preview.2 | 997 | 4/5/2022 |
5.0.0-preview.1 | 1,440 | 3/24/2022 |
4.54.0 | 4,201,696 | 2/16/2023 |
4.53.0 | 963,170 | 2/8/2023 |
4.52.0 | 1,111,463 | 1/25/2023 |
4.51.0 | 1,011,446 | 1/17/2023 |
4.50.0 | 612,437 | 1/5/2023 |
4.49.0 | 943,764 | 12/15/2022 |
4.48.0 | 1,270,598 | 11/23/2022 |
4.47.0 | 1,179,084 | 11/9/2022 |
4.46.0 | 656,939 | 11/2/2022 |
4.45.0 | 1,019,792 | 10/19/2022 |
4.44.0 | 396,873 | 10/12/2022 |
4.43.0 | 312,744 | 10/5/2022 |
4.42.0 | 544,666 | 9/28/2022 |
4.41.0 | 478,328 | 9/22/2022 |
4.40.0 | 432,881 | 9/14/2022 |
4.39.0 | 1,787,980 | 9/6/2022 |
4.38.0 | 375,126 | 8/31/2022 |
4.37.0 | 426,081 | 8/25/2022 |
4.36.0 | 1,960,515 | 8/12/2022 |
4.35.0 | 919,011 | 7/21/2022 |
4.34.0 | 3,827,376 | 7/6/2022 |
4.33.0 | 670,377 | 6/29/2022 |
4.32.0 | 412,401 | 6/21/2022 |
4.31.0 | 233,236 | 6/16/2022 |
4.30.0 | 415,025 | 6/8/2022 |
4.29.0 | 1,172,816 | 5/18/2022 |
4.28.0 | 472,937 | 5/11/2022 |
4.27.0 | 309,478 | 5/4/2022 |
4.26.0 | 144,646 | 4/29/2022 |
4.25.0 | 1,062,542 | 4/13/2022 |
4.24.0 | 339,338 | 4/5/2022 |
4.23.0 | 153,059 | 3/30/2022 |
4.22.0 | 417,882 | 3/22/2022 |
4.21.0 | 343,450 | 3/16/2022 |
4.20.0 | 233,919 | 3/9/2022 |
4.19.0 | 632,132 | 2/24/2022 |
4.18.0 | 644,568 | 2/10/2022 |
4.17.0 | 1,005,275 | 1/27/2022 |
4.16.0 | 309,258 | 1/19/2022 |
4.15.0 | 399,343 | 1/13/2022 |
4.14.0 | 905,816 | 1/5/2022 |
4.13.0 | 576,340 | 12/22/2021 |
4.12.0 | 270,963 | 12/15/2021 |
4.11.0 | 2,436,329 | 11/25/2021 |
4.10.0 | 667,014 | 11/11/2021 |
4.9.0 | 619,060 | 11/3/2021 |
4.8.0 | 165,025 | 10/28/2021 |
4.7.0 | 639,425 | 10/14/2021 |
4.6.0 | 1,307,175 | 9/23/2021 |
4.5.0 | 679,958 | 9/9/2021 |
4.4.0 | 283,891 | 9/2/2021 |
4.3.0 | 355,886 | 8/19/2021 |
4.2.0 | 710,324 | 8/12/2021 |
4.1.0 | 175,582 | 8/5/2021 |
4.0.0 | 545,065 | 7/23/2021 |
4.0.0-preview.7 | 16,030 | 6/18/2021 |
4.0.0-preview.6 | 14,919 | 6/7/2021 |
4.0.0-preview.5 | 8,089 | 5/21/2021 |
4.0.0-preview.4 | 14,999 | 5/7/2021 |
4.0.0-preview.3 | 10,590 | 4/22/2021 |
4.0.0-preview.2 | 11,139 | 4/1/2021 |
4.0.0-preview.1 | 23,237 | 3/17/2021 |
3.35.0 | 4,587,346 | 6/15/2021 |
3.34.0 | 367,412 | 6/10/2021 |
3.33.0 | 2,683,680 | 5/20/2021 |
3.32.0 | 435,941 | 5/12/2021 |
3.31.0 | 231,230 | 5/7/2021 |
3.30.0 | 796,194 | 4/20/2021 |
3.29.0 | 599,869 | 4/2/2021 |
3.28.0 | 286,662 | 3/25/2021 |
3.27.0 | 938,526 | 3/10/2021 |
3.26.0 | 337,585 | 3/4/2021 |
3.25.0 | 455,381 | 2/18/2021 |
3.24.0 | 468,929 | 2/10/2021 |
3.23.0 | 541,232 | 1/29/2021 |
3.22.0 | 529,483 | 1/20/2021 |
3.21.0 | 1,249,411 | 12/8/2020 |
3.20.0 | 1,145,931 | 11/19/2020 |
3.19.0 | 1,243,838 | 10/27/2020 |
3.18.0 | 558,085 | 10/14/2020 |
3.17.0 | 218,095 | 10/10/2020 |
3.16.0 | 241,795 | 10/7/2020 |
3.15.0 | 586,998 | 9/24/2020 |
3.14.0 | 227,077 | 9/15/2020 |
3.13.0 | 138,289 | 9/10/2020 |
3.12.0 | 886,234 | 8/26/2020 |
3.11.0 | 16,001 | 8/25/2020 |
3.10.0 | 153,553 | 8/18/2020 |
3.9.0 | 1,892,085 | 7/28/2020 |
3.8.0 | 1,168,918 | 6/16/2020 |
3.7.0 | 200,323 | 6/9/2020 |
3.6.0 | 666,199 | 5/21/2020 |
3.5.0 | 334,818 | 5/12/2020 |
3.4.0 | 219,418 | 5/1/2020 |
3.3.0 | 388,994 | 4/14/2020 |
3.2.0 | 126,427 | 4/7/2020 |
3.1.0 | 222,768 | 4/1/2020 |
3.0.1 | 362,567 | 3/18/2020 |
1.21.0 | 7,751,107 | 12/11/2019 |
1.20.0 | 710,288 | 11/6/2019 |
1.19.0 | 164,332 | 10/29/2019 |
1.18.0 | 299,248 | 10/15/2019 |
1.17.0 | 840,819 | 8/15/2019 |
1.16.0 | 699,072 | 7/2/2019 |
1.15.0 | 1,257,326 | 5/1/2019 |
1.14.0 | 1,482,150 | 3/25/2019 |
1.14.0-preview | 22,055 | 2/25/2019 |
1.13.0-preview | 27,134 | 12/18/2018 |
1.12.0 | 1,383,353 | 10/31/2018 |
1.11.0 | 304,230 | 9/19/2018 |
1.10.0 | 412,615 | 7/6/2018 |
1.9.0 | 1,722,066 | 5/3/2018 |
1.8.1 | 218,522 | 3/26/2018 |
1.7.0 | 195,434 | 12/14/2017 |
1.6.2 | 157,320 | 10/6/2017 |
1.6.1 | 3,002 | 10/5/2017 |
1.6.0 | 11,718 | 9/26/2017 |
1.5.1 | 75,896 | 8/24/2017 |
1.5.0 | 50,801 | 8/8/2017 |
1.4.0 | 249,076 | 6/12/2017 |
1.3.0 | 192,651 | 5/10/2017 |
1.2.1 | 104,538 | 2/13/2017 |
1.2.0 | 120,907 | 11/8/2016 |
1.1.1 | 116,026 | 9/27/2016 |
1.0.1 | 246,746 | 4/21/2016 |
1.0.0 | 12,373 | 3/30/2016 |
0.2.8-rc | 11,214 | 6/24/2015 |
October 2018 Release Summary (version 1.12.0)
- New DriveItemPreviewRequestBody.cs is the request body content for the preview action bound to the driveItem entity.
- New ItemPreviewInfo.cs is returned by the preview action.
- Added odataType to base types.
- New doc comments for IntelliSense.
- New DriveItemPreviewRequest.cs and DriveItemPreviewRequestBuilder.cs requests. DriveItemRequestBuilder.cs updated to support the DriveItem preview functionality.
- Removed System.Net.Http package reference for .Net target.