Microsoft.Graph 1.12.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.12.0
dotnet add package Microsoft.Graph --version 1.12.0
<PackageReference Include="Microsoft.Graph" Version="1.12.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.Graph --version 1.12.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Microsoft.Graph, 1.12.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.12.0

// Install Microsoft.Graph as a Cake Tool
#tool nuget:?package=Microsoft.Graph&version=1.12.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

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 and msbuild 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.

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

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 and msbuild 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.

Release Notes

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.

NuGet packages (70)

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.
SharePointPnPCore2013
Core CSOM extension methods for SharePoint 2013 add-in model development. This will increase productivity of the developers by abstracting complex operations.

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. Partial support for NL, JA, KO, SV). Contributions are greatly welcome! Packages are available at https://www.nuget.org/profiles/Recognizers.Text and https://www.npmjs.com/~recognizers.text
pnp/PnP-PowerShell
SharePoint PnP PowerShell CmdLets

Version History

Version Downloads Last updated
4.0.0-preview.6 252 6/7/2021
4.0.0-preview.5 932 5/21/2021
4.0.0-preview.4 1,556 5/7/2021
4.0.0-preview.3 1,738 4/22/2021
4.0.0-preview.2 2,815 4/1/2021
4.0.0-preview.1 4,352 3/17/2021
3.34.0 89 6/10/2021
3.33.0 37,716 5/20/2021
3.32.0 26,947 5/12/2021
3.31.0 27,008 5/7/2021
3.30.0 81,703 4/20/2021
3.29.0 93,406 4/2/2021
3.28.0 61,801 3/25/2021
3.27.0 122,148 3/10/2021
3.26.0 58,653 3/4/2021
3.25.0 96,307 2/18/2021
3.24.0 95,182 2/10/2021
3.23.0 112,402 1/29/2021
3.22.0 121,764 1/20/2021
3.21.0 314,447 12/8/2020
3.20.0 230,847 11/19/2020
3.19.0 345,018 10/27/2020
3.18.0 211,155 10/14/2020
3.17.0 104,382 10/10/2020
3.16.0 59,956 10/7/2020
3.15.0 179,193 9/24/2020
3.14.0 99,919 9/15/2020
3.13.0 59,360 9/10/2020
3.12.0 245,890 8/26/2020
3.11.0 2,680 8/25/2020
3.10.0 75,594 8/18/2020
3.9.0 268,057 7/28/2020
3.8.0 547,075 6/16/2020
3.7.0 93,819 6/9/2020
3.6.0 295,043 5/21/2020
3.5.0 158,272 5/12/2020
3.4.0 123,760 5/1/2020
3.3.0 242,026 4/14/2020
3.2.0 84,224 4/7/2020
3.1.0 121,902 4/1/2020
3.0.1 213,671 3/18/2020
1.21.0 1,414,664 12/11/2019
1.20.0 448,810 11/6/2019
1.19.0 104,164 10/29/2019
1.18.0 140,556 10/15/2019
1.17.0 564,482 8/15/2019
1.16.0 440,717 7/2/2019
1.15.0 749,982 5/1/2019
1.14.0 566,055 3/25/2019
1.14.0-preview 13,158 2/25/2019
1.13.0-preview 24,322 12/18/2018
1.12.0 891,710 10/31/2018
1.11.0 259,491 9/19/2018
1.10.0 356,220 7/6/2018
1.9.0 643,589 5/3/2018
1.8.1 189,305 3/26/2018
1.7.0 160,112 12/14/2017
1.6.2 133,801 10/6/2017
1.6.1 1,108 10/5/2017
1.6.0 9,479 9/26/2017
1.5.1 56,556 8/24/2017
1.5.0 33,374 8/8/2017
1.4.0 211,905 6/12/2017
1.3.0 120,001 5/10/2017
1.2.1 85,328 2/13/2017
1.2.0 114,305 11/8/2016
1.1.1 88,416 9/27/2016
1.0.1 51,414 4/21/2016
1.0.0 2,884 3/30/2016
0.2.8-rc 9,029 6/24/2015
Show less