We recently updated our .Net SDK for Microsoft Graph with exciting additions that are aimed at simplifying usage of the client library while providing a great amount of functionality with our underlying middleware pipeline.
Middleware Handlers
The core library now has out of the box implementations for retry, redirect and a authentication handler as part of our middleware components. In addition to these handlers, we have also added middleware configuration options that provide fine grain of middleware on a per request basis.
// Per Request middleware configuration var messages = await graphServiceClient.Me.Messages.Request() .WithScopes(new string[] { "Mail.Read" }) .WithMaxRetry(3) .GetAsync();
If you are interested in adding your custom middleware component implementation, stay tuned for the next release where we will simplify this process.
Updated Models
The model library has been updated with an additional set of Intune and Teams APIs support. We have also added a fluent API to support creating Teams from existing groups.
Bug Fixes
This release also fixes a substantial number of bugs and issues that have been reported by our community on GitHub and Stack Overflow. These are some of the noteworthy bugs that have been fixed as part of this release:
- Removes upper bounds on Newtonsoft.json package reference #345.
- Fixes breaking change with HttpProvider #362.
Microsoft.Graph.Beta Preview
Are the features that you want to use in your solution only available on the beta endpoint? If so, we now generate a beta endpoint client library for Microsoft Graph. It is currently in preview so let us know about your experience so that we can make this generally available. Instructions on how to use the beta service library are provided in our GitHub repo.
This is now available on NuGet as Microsoft.Graph.Beta. Please provide us feedback in our GitHub repo.
Microsoft.Graph.Auth Preview
We are excited to announce the preview of the Microsoft.Graph.Auth library. We simplify the use of Microsoft Authentication Library (MSAL) by providing scenario-based AuthenticationProviders. These providers optimize for working with the Microsoft Graph and simplify the configuration of MSAL applications based on the smaller set of auth scenarios supported by Microsoft Graph. You just need to provide the required information for your scenario and get an authenticated client.
// Create Client Application and Authentication Provider var app = InteractiveAuthenticationProvider.CreateClientApplication(""); var authProvider = new InteractiveAuthenticationProvider(app, new string[] { "User.Read"}); // Create GraphServiceClient with middleware pipeline setup var graphServiceClient = new GraphServiceClient(authProvider);
Instructions on how to use the auth library can be found in our GitHub repo https://github.com/microsoftgraph/msgraph-sdk-dotnet-auth.
This is now available on NuGet as Microsoft.Graph.Auth. We’d love to hear your feedback! Helping to simplify Authentication is one of the most frequest requests we get, so we would love to hear if we are on the right path.