Microsoft.Graph
5.66.0
Prefix Reserved
See the version list below for details.
dotnet add package Microsoft.Graph --version 5.66.0
NuGet\Install-Package Microsoft.Graph -Version 5.66.0
<PackageReference Include="Microsoft.Graph" Version="5.66.0" />
paket add Microsoft.Graph --version 5.66.0
#r "nuget: Microsoft.Graph, 5.66.0"
// Install Microsoft.Graph as a Cake Addin #addin nuget:?package=Microsoft.Graph&version=5.66.0 // Install Microsoft.Graph as a Cake Tool #tool nuget:?package=Microsoft.Graph&version=5.66.0
Microsoft Graph .NET Client Library
Integrate the Microsoft Graph API into your .NET project!
The Microsoft Graph .NET Client Library targets .NetStandard 2.0.
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 the Microsoft Application Registration Portal.
2. Authenticate for the Microsoft Graph service
The Microsoft Graph .NET Client Library supports the use of TokenCredential classes in the Azure.Identity library.
You can read more about available Credential classes here and examples on how to quickly setup TokenCredential instances can be found here.
The recommended library for authenticating against Microsoft Identity (Azure AD) is MSAL.
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.GetAsync();
GetAsync
will return a Drive
object on success and throw a
ApiException
on error.
To get the current user's root folder of their default drive:
// Get the user's driveId
var drive = await graphClient.Me.Drive.GetAsync();
var userDriveId = drive.Id;
// use the driveId to get the root drive
var rootItem = await graphClient.Drives[userDriveId].Root.GetAsync();
GetAsync
will return a DriveItem
object on success and throw a
ApiException
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
- Overview
- Collections
- Errors
- Headers
- Microsoft Graph API
- Release notes
- Blog - Microsoft Graph .NET SDK updates 3/16/20
Notes
Upgrading from v1
Between 1.x and 3.x there were some minor possibly breaking changes:
- .NET Standard minimum version bumped from
netStandard1.3
tonetstandard2.0
- .NET Framework minimum version bumped from
net45
tonet461
- a change in enum order for
GiphyRatingType
ParticipantInfo
becameInvitationParticipantInfo
CallRecordRequestBody
becameCallRecordResponseRequestBody
Upgrading to v4
Between 3.x and 4.x there were some major breaking changes:
- .NET Standard minimum version bumped from
netStandard1.3
tonetstandard2.0
- .NET Framework minimum version bumped from
net45
tonet462
- Replacing Newtosoft.Json with System.Text.Json
- Upgrading Microsoft.Graph.Core dependency to version 2.0.0
View the upgrade guide here.
Upgrading to v5
Between 4.x and 5.x there were several major breaking changes as the SDK now uses Kiota for code generation.
View the upgrade guide here.
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
Due to long file names you may need to run
git config --system core.longpaths true
before cloning the repo to your system.
Additionally for Windows OS, set the value of the parameter
HKLM\SYSTEM\CurrentControlSet\Control\FileSystem
LongPathsEnabled
to1
, before opening the solution in VS
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 is compatible. 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | 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 | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Graph.Core (>= 3.2.1)
-
.NETStandard 2.1
- Microsoft.Graph.Core (>= 3.2.1)
-
net5.0
- Microsoft.Graph.Core (>= 3.2.1)
NuGet packages (212)
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. |
|
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. |
|
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. |
GitHub repositories (58)
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.67.0 | 23,489 | 12/13/2024 |
5.66.0 | 15,308 | 12/11/2024 |
5.65.0 | 74,458 | 12/5/2024 |
5.64.0 | 99,701 | 11/28/2024 |
5.63.0 | 172,630 | 11/20/2024 |
5.62.0 | 478,607 | 11/7/2024 |
5.61.0 | 514,906 | 10/17/2024 |
5.60.0 | 518,171 | 10/9/2024 |
5.59.0 | 214,166 | 10/2/2024 |
5.58.0 | 516,002 | 9/12/2024 |
5.57.0 | 180,593 | 9/5/2024 |
5.56.1 | 338,408 | 8/28/2024 |
5.56.0 | 4,271,590 | 6/6/2024 |
5.55.0 | 280,516 | 5/31/2024 |
5.54.0 | 265,947 | 5/24/2024 |
5.53.0 | 352,477 | 5/16/2024 |
5.52.0 | 410,736 | 5/8/2024 |
5.51.0 | 204,370 | 5/2/2024 |
5.50.0 | 283,418 | 4/25/2024 |
5.49.0 | 527,897 | 4/17/2024 |
5.48.0 | 393,815 | 4/9/2024 |
5.47.0 | 151,133 | 4/5/2024 |
5.46.0 | 333,996 | 3/27/2024 |
5.45.0 | 239,421 | 3/22/2024 |
5.44.0 | 1,136,590 | 2/28/2024 |
5.43.0 | 409,029 | 2/21/2024 |
5.42.0 | 326,105 | 2/14/2024 |
5.41.0 | 1,115,658 | 2/1/2024 |
5.40.0 | 904,629 | 1/24/2024 |
5.39.0 | 348,680 | 1/17/2024 |
5.38.0 | 603,672 | 1/4/2024 |
5.37.0 | 491,957 | 12/14/2023 |
5.36.0 | 918,708 | 11/22/2023 |
5.35.0 | 320,536 | 11/16/2023 |
5.34.0 | 279,421 | 11/8/2023 |
5.33.0 | 181,715 | 11/3/2023 |
5.32.0 | 268,535 | 10/26/2023 |
5.31.0 | 291,218 | 10/19/2023 |
5.30.0 | 165,083 | 10/12/2023 |
5.29.0 | 139,142 | 10/6/2023 |
5.28.0 | 421,549 | 9/21/2023 |
5.27.0 | 184,452 | 9/14/2023 |
5.26.0 | 180,991 | 9/6/2023 |
5.25.0 | 192,426 | 8/31/2023 |
5.24.0 | 307,468 | 8/24/2023 |
5.23.0 | 140,960 | 8/18/2023 |
5.22.0 | 283,841 | 8/10/2023 |
5.21.0 | 219,802 | 8/2/2023 |
5.20.0 | 124,363 | 7/27/2023 |
5.19.0 | 195,244 | 7/19/2023 |
5.18.0 | 219,670 | 7/12/2023 |
5.17.0 | 238,498 | 7/5/2023 |
5.16.0 | 172,800 | 6/29/2023 |
5.15.0 | 300,994 | 6/21/2023 |
5.14.0 | 189,261 | 6/15/2023 |
5.13.0 | 239,748 | 6/9/2023 |
5.12.0 | 581,979 | 5/25/2023 |
5.11.0 | 264,404 | 5/17/2023 |
5.10.0 | 213,284 | 5/11/2023 |
5.9.0 | 159,928 | 5/4/2023 |
5.8.0 | 138,119 | 4/28/2023 |
5.7.0 | 196,691 | 4/20/2023 |
5.6.0 | 284,934 | 4/13/2023 |
5.5.0 | 401,704 | 4/6/2023 |
5.4.0 | 188,056 | 3/29/2023 |
5.3.0 | 228,599 | 3/22/2023 |
5.2.0 | 203,861 | 3/15/2023 |
5.1.0 | 153,932 | 3/8/2023 |
5.0.0 | 232,838 | 2/28/2023 |
5.0.0-rc.5 | 10,001 | 2/9/2023 |
5.0.0-rc.4 | 3,594 | 1/27/2023 |
5.0.0-rc.3 | 2,727 | 1/18/2023 |
5.0.0-rc.2 | 1,368 | 1/11/2023 |
5.0.0-rc.1 | 5,852 | 12/16/2022 |
5.0.0-preview.14 | 64,772 | 11/23/2022 |
5.0.0-preview.13 | 35,965 | 10/19/2022 |
5.0.0-preview.12 | 3,296 | 9/28/2022 |
5.0.0-preview.11 | 1,671 | 9/14/2022 |
5.0.0-preview.10 | 73,508 | 7/20/2022 |
5.0.0-preview.9 | 2,333 | 7/13/2022 |
5.0.0-preview.8 | 20,298 | 6/21/2022 |
5.0.0-preview.7 | 1,037 | 6/9/2022 |
5.0.0-preview.6 | 685 | 6/2/2022 |
5.0.0-preview.5 | 4,784 | 5/20/2022 |
5.0.0-preview.4 | 4,673 | 5/6/2022 |
5.0.0-preview.3 | 3,361 | 4/20/2022 |
5.0.0-preview.2 | 1,019 | 4/5/2022 |
5.0.0-preview.1 | 1,478 | 3/24/2022 |
4.54.0 | 4,420,132 | 2/16/2023 |
4.53.0 | 984,252 | 2/8/2023 |
4.52.0 | 1,134,132 | 1/25/2023 |
4.51.0 | 1,040,954 | 1/17/2023 |
4.50.0 | 624,843 | 1/5/2023 |
4.49.0 | 968,048 | 12/15/2022 |
4.48.0 | 1,297,208 | 11/23/2022 |
4.47.0 | 1,206,269 | 11/9/2022 |
4.46.0 | 669,276 | 11/2/2022 |
4.45.0 | 1,037,644 | 10/19/2022 |
4.44.0 | 406,426 | 10/12/2022 |
4.43.0 | 317,232 | 10/5/2022 |
4.42.0 | 553,707 | 9/28/2022 |
4.41.0 | 496,709 | 9/22/2022 |
4.40.0 | 438,337 | 9/14/2022 |
4.39.0 | 1,873,712 | 9/6/2022 |
4.38.0 | 378,626 | 8/31/2022 |
4.37.0 | 433,414 | 8/25/2022 |
4.36.0 | 2,142,270 | 8/12/2022 |
4.35.0 | 936,243 | 7/21/2022 |
4.34.0 | 3,885,025 | 7/6/2022 |
4.33.0 | 681,898 | 6/29/2022 |
4.32.0 | 416,452 | 6/21/2022 |
4.31.0 | 237,568 | 6/16/2022 |
4.30.0 | 420,313 | 6/8/2022 |
4.29.0 | 1,183,980 | 5/18/2022 |
4.28.0 | 480,315 | 5/11/2022 |
4.27.0 | 312,561 | 5/4/2022 |
4.26.0 | 151,251 | 4/29/2022 |
4.25.0 | 1,091,277 | 4/13/2022 |
4.24.0 | 342,975 | 4/5/2022 |
4.23.0 | 155,300 | 3/30/2022 |
4.22.0 | 423,459 | 3/22/2022 |
4.21.0 | 348,535 | 3/16/2022 |
4.20.0 | 236,748 | 3/9/2022 |
4.19.0 | 649,265 | 2/24/2022 |
4.18.0 | 668,648 | 2/10/2022 |
4.17.0 | 1,011,633 | 1/27/2022 |
4.16.0 | 312,719 | 1/19/2022 |
4.15.0 | 405,136 | 1/13/2022 |
4.14.0 | 912,646 | 1/5/2022 |
4.13.0 | 584,983 | 12/22/2021 |
4.12.0 | 273,589 | 12/15/2021 |
4.11.0 | 2,487,692 | 11/25/2021 |
4.10.0 | 676,151 | 11/11/2021 |
4.9.0 | 622,488 | 11/3/2021 |
4.8.0 | 166,453 | 10/28/2021 |
4.7.0 | 644,585 | 10/14/2021 |
4.6.0 | 1,328,442 | 9/23/2021 |
4.5.0 | 690,239 | 9/9/2021 |
4.4.0 | 287,304 | 9/2/2021 |
4.3.0 | 363,900 | 8/19/2021 |
4.2.0 | 743,110 | 8/12/2021 |
4.1.0 | 178,511 | 8/5/2021 |
4.0.0 | 552,267 | 7/23/2021 |
4.0.0-preview.7 | 16,145 | 6/18/2021 |
4.0.0-preview.6 | 15,029 | 6/7/2021 |
4.0.0-preview.5 | 8,164 | 5/21/2021 |
4.0.0-preview.4 | 15,026 | 5/7/2021 |
4.0.0-preview.3 | 10,825 | 4/22/2021 |
4.0.0-preview.2 | 11,185 | 4/1/2021 |
4.0.0-preview.1 | 23,404 | 3/17/2021 |
3.35.0 | 4,642,677 | 6/15/2021 |
3.34.0 | 376,092 | 6/10/2021 |
3.33.0 | 2,774,303 | 5/20/2021 |
3.32.0 | 444,341 | 5/12/2021 |
3.31.0 | 234,652 | 5/7/2021 |
3.30.0 | 808,766 | 4/20/2021 |
3.29.0 | 606,689 | 4/2/2021 |
3.28.0 | 290,285 | 3/25/2021 |
3.27.0 | 943,577 | 3/10/2021 |
3.26.0 | 343,914 | 3/4/2021 |
3.25.0 | 459,019 | 2/18/2021 |
3.24.0 | 472,703 | 2/10/2021 |
3.23.0 | 547,499 | 1/29/2021 |
3.22.0 | 535,590 | 1/20/2021 |
3.21.0 | 1,259,623 | 12/8/2020 |
3.20.0 | 1,158,049 | 11/19/2020 |
3.19.0 | 1,252,433 | 10/27/2020 |
3.18.0 | 561,591 | 10/14/2020 |
3.17.0 | 218,587 | 10/10/2020 |
3.16.0 | 243,029 | 10/7/2020 |
3.15.0 | 591,282 | 9/24/2020 |
3.14.0 | 228,758 | 9/15/2020 |
3.13.0 | 139,297 | 9/10/2020 |
3.12.0 | 892,888 | 8/26/2020 |
3.11.0 | 16,151 | 8/25/2020 |
3.10.0 | 154,713 | 8/18/2020 |
3.9.0 | 2,350,828 | 7/28/2020 |
3.8.0 | 1,176,870 | 6/16/2020 |
3.7.0 | 202,123 | 6/9/2020 |
3.6.0 | 669,800 | 5/21/2020 |
3.5.0 | 336,564 | 5/12/2020 |
3.4.0 | 220,496 | 5/1/2020 |
3.3.0 | 390,900 | 4/14/2020 |
3.2.0 | 127,635 | 4/7/2020 |
3.1.0 | 224,797 | 4/1/2020 |
3.0.1 | 364,257 | 3/18/2020 |
1.21.0 | 7,802,104 | 12/11/2019 |
1.20.0 | 714,228 | 11/6/2019 |
1.19.0 | 167,565 | 10/29/2019 |
1.18.0 | 300,455 | 10/15/2019 |
1.17.0 | 846,909 | 8/15/2019 |
1.16.0 | 703,059 | 7/2/2019 |
1.15.0 | 1,267,701 | 5/1/2019 |
1.14.0 | 1,500,934 | 3/25/2019 |
1.14.0-preview | 22,145 | 2/25/2019 |
1.13.0-preview | 27,156 | 12/18/2018 |
1.12.0 | 1,388,579 | 10/31/2018 |
1.11.0 | 304,796 | 9/19/2018 |
1.10.0 | 414,310 | 7/6/2018 |
1.9.0 | 1,750,592 | 5/3/2018 |
1.8.1 | 218,925 | 3/26/2018 |
1.7.0 | 196,100 | 12/14/2017 |
1.6.2 | 157,554 | 10/6/2017 |
1.6.1 | 3,031 | 10/5/2017 |
1.6.0 | 11,752 | 9/26/2017 |
1.5.1 | 76,375 | 8/24/2017 |
1.5.0 | 51,238 | 8/8/2017 |
1.4.0 | 249,307 | 6/12/2017 |
1.3.0 | 193,981 | 5/10/2017 |
1.2.1 | 104,966 | 2/13/2017 |
1.2.0 | 121,006 | 11/8/2016 |
1.1.1 | 116,147 | 9/27/2016 |
1.0.1 | 251,929 | 4/21/2016 |
1.0.0 | 12,547 | 3/30/2016 |
0.2.8-rc | 11,440 | 6/24/2015 |