diff --git a/.github/workflows/validatePullRequest.yml b/.github/workflows/validatePullRequest.yml index 0b9a83a89a1..9b200aa3212 100644 --- a/.github/workflows/validatePullRequest.yml +++ b/.github/workflows/validatePullRequest.yml @@ -11,8 +11,6 @@ jobs: build: runs-on: ubuntu-latest env: - NUGET_URL: https://nuget.pkg.github.com/microsoft/index.json - GRAPH_NUGET_URL: https://nuget.pkg.github.com/microsoftgraph/index.json solutionName: Microsoft.Graph.sln steps: - uses: actions/checkout@v2.4.0 @@ -24,12 +22,6 @@ jobs: uses: github/codeql-action/init@v1 with: languages: csharp - - name: Add NuGet kiota source - run: | - dotnet nuget add source ${{env.NUGET_URL}} -n ReadKiotaGithubPackages -u ${{secrets.PUBLISH_GH_USERNAME}} -p ${{secrets.PUBLISH_GH_TOKEN}} --store-password-in-clear-text - - name: Add Graph Core source - run: | - dotnet nuget add source ${{env.GRAPH_NUGET_URL}} -n ReadGithubPackages -u ${{secrets.PUBLISH_GH_USERNAME}} -p ${{secrets.PUBLISH_GH_TOKEN}} --store-password-in-clear-text - name: Restore dependencies run: dotnet restore ${{ env.solutionName }} - name: Build diff --git a/Nuget.Config b/Nuget.Config index 27bcd312e0c..7d7e3a9818e 100644 --- a/Nuget.Config +++ b/Nuget.Config @@ -2,7 +2,5 @@ - - \ No newline at end of file diff --git a/README.md b/README.md index be3ed0e64ce..f2b61c1b5ff 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Integrate the [Microsoft Graph API](https://graph.microsoft.io) into your .NET project! -The Microsoft Graph .NET Client Library targets .NetStandard 2.0 and .Net Framework 4.6.1. +The Microsoft Graph .NET Client Library targets .NetStandard 2.1 ## Installation via NuGet @@ -27,8 +27,6 @@ The Microsoft Graph .NET Client Library supports the use of TokenCredential clas You can read more about available Credential classes [here](https://docs.microsoft.com/en-us/dotnet/api/overview/azure/identity-readme#key-concepts) and examples on how to quickly setup TokenCredential instances can be found [here](docs/tokencredentials.md). -For more information on `DelegateAuthenticationProvider`, see the [library overview](docs/overview.md). - The recommended library for authenticating against Microsoft Identity (Azure AD) is [MSAL](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet). For an example of authenticating a UWP app using the V2 Authentication Endpoint, see the [Microsoft Graph UWP Connect Library](https://github.com/OfficeDev/Microsoft-Graph-UWP-Connect-Library). @@ -51,20 +49,20 @@ of the Microsoft Graph API's RESTful syntax. For example, to retrieve a user's default drive: ```csharp -var drive = await graphClient.Me.Drive.Request().GetAsync(); +var drive = await graphClient.Me.Drive.GetAsync(); ``` `GetAsync` will return a `Drive` object on success and throw a -`ServiceException` on error. +`ApiException` on error. To get the current user's root folder of their default drive: ```csharp -var rootItem = await graphClient.Me.Drive.Root.Request().GetAsync(); +var rootItem = await graphClient.Me.Drive.Root.GetAsync(); ``` `GetAsync` will return a `DriveItem` object on success and throw a -`ServiceException` on error. +`ApiException` on error. For a general overview of how the SDK is designed, see [overview](docs/overview.md). @@ -112,6 +110,13 @@ Between 3.x and 4.x there were some major breaking changes: View the upgrade guide [here](docs/upgrade-to-v4.md). + +### 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 guide [here](docs/upgrade-to-v5.md). + ## Issues To view or log issues, see [issues](https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues). diff --git a/docs/collections.md b/docs/collections.md index 55e279152d1..0f34cda5bb3 100644 --- a/docs/collections.md +++ b/docs/collections.md @@ -10,18 +10,17 @@ To retrieve a collection, like the list of groups in the service, you call `GetA ```csharp await graphServiceClient .Groups - .Request() .GetAsync(); ``` -`GetAsync` returns an `ICollectionPage` implementation on success and throws a `ServiceException` on error. For the groups collection, the type returned is `IGraphServiceGroupsCollectionPage`, which inherits `ICollectionPage`. +`GetAsync` returns an `IParsable` implementation on success and throws a `ServiceException` on error. -`IGraphServiceGroupsCollectionPage` contains three properties: +The `IParsable` instance returned will typically contain two properties: |Name |Description | |--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------| -|**CurrentPage** |An `IList`. | -|**NextPageRequest** |An `IGraphServiceGroupsCollectionRequest` used to get to the next page of items, if another page exists. This value will be null if there is not a next page.| +|**Value** |An `List`. | +|**NextLink** |A `string` representing the url used to get to the next page of items, if another page exists. This value will be null if there is not a next page.| |**AdditionalData** |An `IDictionary` to any additional values returned by the service. In this case, none. | ## Adding to a collection @@ -38,12 +37,11 @@ var groupToCreate = new Group }; var newGroup = await graphServiceClient - .Groups - .Request() - .AddAsync(groupToCreate); + .Groups + .PostAsync(groupToCreate); ``` -`AddAsync` returns the created group on success and throws a `ServiceException` on error. +`AddAsync` returns the created group on success and throws a `ApiException` on error. ## Expanding a collection @@ -55,7 +53,5 @@ var children = await graphServiceClient .Drive .Items[itemId] .Children - .Request() - .Expand("thumbnails") - .GetAsync(); + .GetAsync((q) => q.Expand = new string[] { "thumbnails" }); ``` diff --git a/docs/headers.md b/docs/headers.md index a693c23030f..38f6cfbe642 100644 --- a/docs/headers.md +++ b/docs/headers.md @@ -1,6 +1,5 @@ # Headers in the Microsoft Graph .NET Client Library - The .NET Client Library allows you to add your own custom request headers and inspect the response headers that come back from the Graph service. ## Adding request headers @@ -8,46 +7,10 @@ The .NET Client Library allows you to add your own custom request headers and in Custom headers can be added by creating a new option collection and adding it to the request object: ```csharp -List