March 8th, 2023

Microsoft Graph .NET SDK v5 is now generally available 

Maisa Rissi
Product Manager

The Microsoft Graph .NET SDK v5, now generally available (GA), allows you to take advantage of a fluent API and models that support retry handling, secure redirects, batching requests, large file management, and many more capabilities. Focus on what really matters, your business.  

Along with all the features and improvements highlighted in the v5 release candidate announcement, such OData cast support and backing store, this GA release delivers a small change described below. 

OData cast now provides shorter names 

Because OData cast allows downcasting the result to the right specialized type, v5 users now have access to all properties in the response, rather than pulling those out from the AdditionalData. To not require users to use the fully qualified name as a code path to cast, the OData cast was simplified to provide the shortest name possible when still avoiding collisions. 

https://gist.github.com/maisarissi/f9a6825cd51abc5128049af1b4a805fb

For those using v5 preview versions, the OData cast was shortened from MicrosoftGraph<Entity> to Graph<Entity>. In the example above, it changed from MicrosoftGraphUser to GraphUser. 

Methods doesn’t require full namespaces 

As a similar approach to the OData cast, users now don’t need to specify the MicrosoftGraph namespace as part of the method. This change simplifies the fluentAPI by keeping only the method name as part of the method chaining. 

https://gist.github.com/maisarissi/68f10c40921fc872b9deed775d2580c2

For those using previews versions of v5, the method was shortened from MicrosoftGraph<Method> to only <Method>, given the example above, it changed from MicrosoftGraphSendMail to SendMail. 

Next steps 

Check it out this upgrade guide to access a detailed document that outlines any breaking changes, fixes and will guide you through the migration that an SDK user might run while upgrading to v5 as well as provide examples for implementing the new features, helping you quickly take advantage of all the new capabilities. 

Add the new SDK to your project by running the following command in the Package Manager Console: 

Install-Package Microsoft.Graph 

Try out the new version today! 

Try out the new version and let us know what you think on GitHub! For questions about the Microsoft Graph API, go to Microsoft Q&A. 

Learn more about Microsoft Graph SDKs 

The SDK includes a set of tools, libraries, and documentation that make it easy to get started building applications that take advantage of the rich data and insights available through Microsoft Graph API.

Start saving time and removing complexity in your code today. Sign up for the Microsoft 365 Developer Program to get a free Microsoft 365 developer subscription and start using .NET to connect to Microsoft Graph. We also recommend that you join our Microsoft 365 Platform community calls and events and get involved with other developers who use Microsoft Graph and build solutions for Microsoft 365. 

Here are some resources we have pulled together to help you get started. 

Thank you! 

We’d like to thank all the members of the community who have helped us make this release better by reporting issues in GitHub! Keep them coming! 

Author

Maisa Rissi
Product Manager

2 comments

Discussion is closed. Login to edit/delete existing comments.

  • Tavi Truman · Edited

    Where is the production version of the documentation for the Kiota v5 API set? Where can I find the following documentation for the following APIs:

    //Fetching the members of a group who are of the type User
    var usersInGroup = await graphServiceClient
        .Groups[“group-id”]
        .Members
      .MicrosoftGraphUser
        .GetAsync();

    List userList = usersInGroup.Value;

    //Similarly, members of the group of type ServicePrincipal
    var servicePrincipalsInGroup = await graphServiceClient
        .Groups[“group-id”]
        .Members
      .MicrosoftGraphServicePrincipal
        .GetAsync();

    List servicePrincipalList = servicePrincipalsInGroup.Value;

  • Vaclav Elias

    Any ASP.NET Core example, targeting this new SDK? Specifically the authentication? I had problem with .AddMicrosoftGraph() which wasn’t working with this version because it was targeting different version of Microsoft.Graph.Core.