Microsoft.Graph 1.7.0

Microsoft Graph Client Library allows you to call Office 365, Azure AD and other Microsoft services through a single unified developer experience.

There is a newer version of this package available.
See the version list below for details.
Install-Package Microsoft.Graph -Version 1.7.0
dotnet add package Microsoft.Graph --version 1.7.0
<PackageReference Include="Microsoft.Graph" Version="1.7.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.Graph --version 1.7.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Microsoft.Graph, 1.7.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Microsoft.Graph as a Cake Addin
#addin nuget:?package=Microsoft.Graph&version=1.7.0

// Install Microsoft.Graph as a Cake Tool
#tool nuget:?package=Microsoft.Graph&version=1.7.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Microsoft Graph .NET Client Library

Build status
NuGet Version

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:

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:

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

License

Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT license

Microsoft Graph .NET Client Library

Build status
NuGet Version

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:

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:

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

License

Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT license

Release Notes

December 2017 Release Summary (version 1.7.0)

     New feature
     * Include symbols in the Nuget package.

NuGet packages (73)

Showing the top 5 NuGet packages that depend on Microsoft.Graph:

Package Downloads
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.
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.
Microsoft.Graph.Communications.Core
Microsoft Graph Communications Client Core Library - This library builds on the Microsoft.Graph SDK to provide better support for the Communications APIs.
SharePointPnPCore2016
Core CSOM extension methods for SharePoint 2016 add-in model development. This will increase productivity of the developers by abstracting complex operations.
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.

GitHub repositories (29)

Showing the top 5 popular GitHub repositories that depend on Microsoft.Graph:

Repository Stars
unoplatform/uno
Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
pnp/PnP
SharePoint / Office 365 Developer Patterns and Practices - Legacy solutions
lukencode/FluentEmail
All in one email sender for .NET. Supports popular senders (SendGrid, MailGun, etc) and Razor templates.
microsoft/Recognizers-Text
Microsoft.Recognizers.Text provides recognition and resolution of numbers, units, and date/time expressed in multiple languages (ZH, EN, FR, ES, PT, DE, IT, TR, HI, NL. Partial support for JA, KO, AR, SV). Contributions are greatly welcome! Packages are available at https://www.nuget.org/profiles/Recognizers.Text and https://www.npmjs.com/~recognizers.text
MicrosoftLearning/AZ-204-DevelopingSolutionsforMicrosoftAzure
AZ-204: Developing solutions for Microsoft Azure

Version History

Version Downloads Last updated
4.0.0-preview.7 199 6/18/2021
4.0.0-preview.6 1,044 6/7/2021
4.0.0-preview.5 1,164 5/21/2021
4.0.0-preview.4 1,892 5/7/2021
4.0.0-preview.3 1,969 4/22/2021
4.0.0-preview.2 3,179 4/1/2021
4.0.0-preview.1 4,976 3/17/2021
3.35.0 7,605 6/15/2021
3.34.0 8,140 6/10/2021
3.33.0 63,131 5/20/2021
3.32.0 34,543 5/12/2021
3.31.0 34,042 5/7/2021
3.30.0 95,491 4/20/2021
3.29.0 105,335 4/2/2021
3.28.0 68,183 3/25/2021
3.27.0 134,169 3/10/2021
3.26.0 62,902 3/4/2021
3.25.0 103,800 2/18/2021
3.24.0 102,733 2/10/2021
3.23.0 119,454 1/29/2021
3.22.0 130,241 1/20/2021
3.21.0 329,344 12/8/2020
3.20.0 240,295 11/19/2020
3.19.0 360,818 10/27/2020
3.18.0 218,060 10/14/2020
3.17.0 107,049 10/10/2020
3.16.0 62,649 10/7/2020
3.15.0 182,271 9/24/2020
3.14.0 102,551 9/15/2020
3.13.0 60,740 9/10/2020
3.12.0 252,803 8/26/2020
3.11.0 2,769 8/25/2020
3.10.0 76,745 8/18/2020
3.9.0 273,401 7/28/2020
3.8.0 554,356 6/16/2020
3.7.0 95,137 6/9/2020
3.6.0 301,383 5/21/2020
3.5.0 160,456 5/12/2020
3.4.0 125,316 5/1/2020
3.3.0 245,066 4/14/2020
3.2.0 84,879 4/7/2020
3.1.0 123,389 4/1/2020
3.0.1 216,286 3/18/2020
1.21.0 1,447,525 12/11/2019
1.20.0 451,517 11/6/2019
1.19.0 105,301 10/29/2019
1.18.0 141,768 10/15/2019
1.17.0 567,550 8/15/2019
1.16.0 443,304 7/2/2019
1.15.0 760,521 5/1/2019
1.14.0 574,209 3/25/2019
1.14.0-preview 13,233 2/25/2019
1.13.0-preview 24,409 12/18/2018
1.12.0 896,256 10/31/2018
1.11.0 260,521 9/19/2018
1.10.0 356,804 7/6/2018
1.9.0 649,075 5/3/2018
1.8.1 189,753 3/26/2018
1.7.0 160,357 12/14/2017
1.6.2 134,088 10/6/2017
1.6.1 1,112 10/5/2017
1.6.0 9,516 9/26/2017
1.5.1 56,643 8/24/2017
1.5.0 33,457 8/8/2017
1.4.0 212,410 6/12/2017
1.3.0 120,516 5/10/2017
1.2.1 85,447 2/13/2017
1.2.0 114,373 11/8/2016
1.1.1 88,521 9/27/2016
1.0.1 51,461 4/21/2016
1.0.0 2,894 3/30/2016
0.2.8-rc 9,034 6/24/2015
Show less