'Microsoft Graph API IN n a Web Forms application

I want to use Micrsosoft Graph Api in a web forms application, although there are only tutorials of Microsoft Graph API in a console application or MVC applications.

I saw this tutorial explaining how I can use the Web Api in a web forms applications. https://docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/using-web-api-with-aspnet-web-forms

I wonder if the same logic will work with Graph Api. Do I have to create a model and controller in Web forms to use Graph Api?

I hope I explained it well.

Can someone advise please?

Thank you very much in advance.



Solution 1:[1]

If you want to call graph api in your c# project, then you need to make sure you have an azure ad application first with the correct api permission.

Then you need to install 2 packages into your application, and for example using client credential flow to call graph api, this is my test result.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tiny Wang