Microsoft.Graph 1.9.0

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

Install-Package Microsoft.Graph -Version 1.9.0
dotnet add package Microsoft.Graph --version 1.9.0
paket add Microsoft.Graph --version 1.9.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

May 2018 Release Summary (version 1.9.0)

New features
- Added more comments.
- UserActivity - apps can push information to the user's timeline.
- Updated timezone information.
- Updates to Intune functionality.
- New Outlook functionality which includes an OutlookUser object, categories, coordinates, message rules, and working hours.
- New OneNote functionality which includes a notebook's site collection.

Bug fixes
- Fixed Site GetByPath

Version History

Version Downloads Last updated
1.9.0 (current) 20,432 5/3/2018
1.8.1 29,885 3/26/2018
1.7.0 66,088 12/14/2017
1.6.2 75,056 10/6/2017
1.6.1 316 10/5/2017
1.6.0 6,912 9/26/2017
1.5.1 24,430 8/24/2017
1.5.0 10,391 8/8/2017
1.4.0 62,154 6/12/2017
1.3.0 49,719 5/10/2017
1.2.1 53,778 2/13/2017
1.2.0 55,490 11/8/2016
1.1.1 33,412 9/27/2016
1.0.1 28,121 4/21/2016
1.0.0 1,673 3/30/2016
0.2.8-rc 7,427 6/24/2015