Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Microsoft Graph Client Library for .NET!

License

NotificationsYou must be signed in to change notification settings

microsoftgraph/msgraph-sdk-dotnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Validate Pull RequestNuGet Version

Integrate theMicrosoft 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 forMicrosoft.Graph in the NuGet Library, or
  • TypeInstall-Package Microsoft.Graph into the Package Manager Console.

Getting started

1. Register your application

Register your application to use Microsoft Graph API using theMicrosoft Application Registration Portal.

2. Authenticate for the Microsoft Graph service

The Microsoft Graph .NET Client Library supports the use of TokenCredential classes in theAzure.Identity library.

You can read more about available Credential classeshere and examples on how to quickly setup TokenCredential instances can be foundhere.

The recommended library for authenticating against Microsoft Identity (Azure AD) isMSAL.

For an example of authenticating a UWP app using the V2 Authentication Endpoint, see theMicrosoft Graph UWP Connect Library.

3. Create a Microsoft Graph client object with an authentication provider

An instance of theGraphServiceClient class handles building requests,sending them to Microsoft Graph API, and processing the responses. To create anew instance of this class, you need to provide an instance ofIAuthenticationProvider which can authenticate requests to Microsoft Graph.

For more information on initializing a client instance, see thelibrary overview

4. Make requests to the graph

Once you have completed authentication and have a GraphServiceClient, you canbegin to make calls to the service. The requests in the SDK follow the formatof the Microsoft Graph API's RESTful syntax.

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

vardrive=awaitgraphClient.Me.Drive.GetAsync();

GetAsync will return aDrive object on success and throw aApiException on error.

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

// Get the user's driveIdvardrive=awaitgraphClient.Me.Drive.GetAsync();varuserDriveId=drive.Id;// use the driveId to get the root drivevarrootItem=awaitgraphClient.Drives[userDriveId].Root.GetAsync();

GetAsync will return aDriveItem object on success and throw aApiException on error.

For a general overview of how the SDK is designed, seeoverview.

The following sample applications are also available:

Documentation and resources

Notes

Upgrading from v1

Between 1.x and 3.x there were some minor possibly breaking changes:

  • .NET Standard minimum version bumped fromnetStandard1.3 tonetstandard2.0
  • .NET Framework minimum version bumped fromnet45 tonet461
  • a change in enum order forGiphyRatingType
  • ParticipantInfo becameInvitationParticipantInfo
  • CallRecordRequestBody becameCallRecordResponseRequestBody

Upgrading to v4

Between 3.x and 4.x there were some major breaking changes:

  • .NET Standard minimum version bumped fromnetStandard1.3 tonetstandard2.0
  • .NET Framework minimum version bumped fromnet45 tonet462
  • Replacing Newtosoft.Json with System.Text.Json
  • Upgrading Microsoft.Graph.Core dependency to version 2.0.0

View the upgrade guidehere.

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 guidehere.

Issues

To view or log issues, seeissues.

This project has adopted theMicrosoft Open Source Code of Conduct. For more information see theCode of Conduct FAQ or contactopencode@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
  • Rundotnet restore from the command line in your package directory
  • Runnuget 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 rungit config --system core.longpaths true before cloning the repo to your system.

Additionally for Windows OS, set the value of the parameterHKLM\SYSTEM\CurrentControlSet\Control\FileSystemLongPathsEnabled to1, before opening the solution in VS

License

Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MITlicense. SeeThird Party Notices for information on the packages referenced via NuGet.

About

Microsoft Graph Client Library for .NET!

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors68

Languages


[8]ページ先頭

©2009-2025 Movatter.jp