Microsoft.Graph.Core 3.1.8

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Microsoft.Graph.Core --version 3.1.8
NuGet\Install-Package Microsoft.Graph.Core -Version 3.1.8
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.Graph.Core" Version="3.1.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.Graph.Core --version 3.1.8
#r "nuget: Microsoft.Graph.Core, 3.1.8"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Microsoft.Graph.Core as a Cake Addin
#addin nuget:?package=Microsoft.Graph.Core&version=3.1.8

// Install Microsoft.Graph.Core as a Cake Tool
#tool nuget:?package=Microsoft.Graph.Core&version=3.1.8

Microsoft Graph .NET Core Client Library

Build Status NuGet Version

Integrate the Microsoft Graph API into your .NET project!

The Microsoft Graph .NET Core Client Library contains core classes and interfaces used by Microsoft.Graph Client Library to send native HTTP requests to Microsoft Graph API. The core 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.Core in the NuGet Library, or
  • Type Install-Package Microsoft.Graph.Core into the Package Manager Console.

Getting started

1. Register your application

Register your application to use Microsoft Graph API by following the steps at Register your application with the Microsoft identity platform.

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 HttpClient object with an authentication provider

You can create an instance of HttpClient that is pre-configured for making requests to Microsoft Graph APIs using GraphClientFactory.

HttpClient httpClient = GraphClientFactory.Create( version: "beta");

For more information on initializing a client instance, see the library overview

4. Make requests to the graph

Once you have an authenticated HttpClient, you can begin to make calls to the service. The requests to the service follows our REST API syntax.

For example, to retrieve a user's default drive:

HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, "me/drive");
HttpResponseMessage response = await httpClient.SendAsync(requestMessage);
if (response.IsSuccessStatusCode)
{
    string jsonResponse = await response.Content.ReadAsStringAsync();
}

To get the current user's root folder of their default drive:

HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, "me/drive/root");
HttpResponseMessage response = await httpClient.SendAsync(requestMessage);
if (response.IsSuccessStatusCode)
{
    string jsonResponse = await response.Content.ReadAsStringAsync();
}

Documentation and resources

Notes

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.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-android31.0 is compatible.  net6.0-ios was computed.  net6.0-ios16.1 is compatible.  net6.0-maccatalyst was computed.  net6.0-maccatalyst16.1 is compatible.  net6.0-macos was computed.  net6.0-macos13.0 is compatible.  net6.0-tvos was computed.  net6.0-windows was computed.  net6.0-windows7.0 is compatible.  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 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (35)

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

Package Downloads
Microsoft.Graph The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

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

Microsoft.Graph.Auth The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Microsoft Graph Authentication Library implements authentication functionality used by Microsoft Graph Client Library. It provides a set of OAuth scenario-centric providers that implement Microsoft.Graph.IAuthenticationProvider and uses Microsoft Authentication Library (MSAL) to handle access token acquisition and storage.

Microsoft.Graph.Beta The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Microsoft Graph beta client library allows you to target the Microsoft Graph /beta endpoint. You can call Office 365, Azure AD and other Microsoft services through a single unified developer experience.

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.

Microsoft.Graph.Communications.Core The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Microsoft Graph Communications Client Core Library - This library builds on the Microsoft.Graph SDK to provide better support for the Communications APIs.

GitHub repositories (22)

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

Repository Stars
ONLYOFFICE/CommunityServer
Free open source office suite with business productivity tools: document and project management, CRM, mail aggregator.
pnp/PnP
SharePoint / Office 365 Developer Patterns and Practices - Archived older solutions. Please see https://aka.ms/m365pnp for updated guidance
pnp/PnP-PowerShell
SharePoint PnP PowerShell CmdLets
Kyrodan/KeeAnywhere
A cloud storage provider plugin for KeePass Password Safe
microsoftgraph/msgraph-sdk-dotnet
Microsoft Graph Client Library for .NET!
Version Downloads Last updated
3.1.10 17,888 3/28/2024
3.1.9 87,658 3/18/2024
3.1.8 405,047 2/16/2024
3.1.8-preview.1 71 2/27/2024
3.1.7 119,058 2/9/2024
3.1.6 420,640 1/23/2024
3.1.5 178,831 1/15/2024
3.1.4 17,612 1/9/2024
3.1.3 570,871 11/29/2023
3.1.2 641,926 11/15/2023
3.1.1 153,687 11/7/2023
3.1.0 297,526 10/24/2023
3.0.11 928,090 9/5/2023
3.0.11-preview.1 178 9/1/2023
3.0.10 640,859 8/8/2023
3.0.10-preview.1 587 7/13/2023
3.0.9 868,793 6/29/2023
3.0.9-preview.1 160 6/29/2023
3.0.8 7,975 6/27/2023
3.0.7 548,516 5/30/2023
3.0.6 1,133,191 4/18/2023
3.0.6-preview.1 153 4/18/2023
3.0.5 520,039 3/30/2023
3.0.4 143,344 3/27/2023
3.0.3 172,318 3/21/2023
3.0.2 151,093 3/13/2023
3.0.1 118,463 3/7/2023
3.0.0 151,807 2/28/2023
3.0.0-rc.6 7,701 2/9/2023
3.0.0-rc.5 4,231 1/26/2023
3.0.0-rc.4 227 1/25/2023
3.0.0-rc.3 2,760 1/18/2023
3.0.0-rc.2 1,746 1/11/2023
3.0.0-rc.1 10,058 12/16/2022
3.0.0-preview.19 237 12/14/2022
3.0.0-preview.18 353 12/6/2022
3.0.0-preview.17 100,787 11/23/2022
3.0.0-preview.16 112,577 10/18/2022
3.0.0-preview.15 410 10/3/2022
3.0.0-preview.14 5,223 9/28/2022
3.0.0-preview.13 2,312 9/6/2022
3.0.0-preview.12 409 8/29/2022
3.0.0-preview.11 69,831 7/20/2022
3.0.0-preview.10 2,272 7/13/2022
3.0.0-preview.9 21,452 6/21/2022
3.0.0-preview.8 1,970 6/9/2022
3.0.0-preview.7 1,498 5/31/2022
3.0.0-preview.6 5,750 5/20/2022
3.0.0-preview.5 11,996 5/4/2022
3.0.0-preview.4 3,854 4/13/2022
3.0.0-preview.3 318 4/12/2022
3.0.0-preview.2 1,121 4/1/2022
3.0.0-preview.1 2,134 3/22/2022
2.0.15 2,547,520 2/9/2023
2.0.14 7,019,386 10/11/2022
2.0.13 793,789 9/27/2022
2.0.13-preview.1 200 9/26/2022
2.0.12 2,712,598 8/24/2022
2.0.11 829,367 8/11/2022
2.0.10 789,465 7/20/2022
2.0.9 4,291,136 6/9/2022
2.0.8 4,912,796 2/18/2022
2.0.7 3,472,900 12/16/2021
2.0.6 288,660 12/2/2021
2.0.5 6,007,749 9/1/2021
2.0.4 48,911 8/24/2021
2.0.3 344,467 8/17/2021
2.0.2 506,370 8/11/2021
2.0.1 158,542 8/5/2021
2.0.0 491,863 7/22/2021
2.0.0-preview.14 2,398 7/7/2021
2.0.0-preview.13 41,876 6/18/2021
2.0.0-preview.12 39,054 6/7/2021
2.0.0-preview.11 58,652 5/7/2021
2.0.0-preview.10 38,439 4/21/2021
2.0.0-preview.9 23,490 4/1/2021
2.0.0-preview.8 38,244 3/17/2021
2.0.0-preview.7 556 3/2/2021
2.0.0-preview.6 418 2/24/2021
2.0.0-preview.5 300 2/24/2021
2.0.0-preview.4 5,092 1/6/2021
2.0.0-preview.3 27,355 4/29/2020
2.0.0-preview.2 2,377 4/9/2020
2.0.0-preview.1 16,034 3/9/2020
1.25.1 9,735,331 3/25/2021
1.25.1-preview.2 281 3/25/2021
1.25.1-preview.1 303 3/25/2021
1.25.0 255,542 3/25/2021
1.25.0-preview.2 318 3/20/2021
1.25.0-preview.1 522 3/17/2021
1.24.0 3,151,001 1/19/2021
1.24.0-preview.1 320 1/14/2021
1.23.0 2,763,108 11/26/2020
1.22.0 3,270,943 10/7/2020
1.22.0-preview.2 405 10/6/2020
1.22.0-preview.1 405 7/28/2020
1.21.0 2,457,636 7/28/2020
1.21.0-preview.1 3,050 6/19/2020
1.20.1 5,156,449 3/31/2020
1.20.0 6,814,190 2/5/2020
1.19.0 2,734,664 12/11/2019
1.18.0 1,339,438 10/10/2019
1.17.0 898,665 8/15/2019
1.16.0 122,644 7/3/2019
1.15.0 2,122,333 5/1/2019
1.14.1 149,066 3/29/2019
1.14.0 1,249,436 3/25/2019
1.12.0 1,332,128 10/31/2018
1.11.0 312,069 9/19/2018
1.10.0 410,513 7/6/2018
1.9.0 1,460,835 5/3/2018
1.8.1 217,689 3/23/2018
1.7.0 195,681 12/14/2017
1.6.2 168,436 9/26/2017
1.6.1 80,571 8/24/2017
1.6.0 48,377 8/8/2017
1.5.0 254,087 6/12/2017
1.4.0 293,080 5/10/2017
1.3.1 65,111 4/3/2017
1.3.0 207,731 11/8/2016
1.2.1 144,002 9/27/2016
1.1.1 12,014 8/8/2016
1.1.0 4,481 8/6/2016

- Updates the Kiota dependencies to the latest version.
- Add null-checks to properties of ServiceException when IsMatch is called to prevent a NullReferenceException