Posts

Showing posts from April, 2023

Implement graph API in Mvc 5

  To implement a graph API to search users in an MVC 5 application, you can follow these steps: Register your MVC 5 application in Azure AD and obtain the necessary client ID and secret for authentication. Install the Microsoft.Graph NuGet package in your MVC 5 application. Create a new class that will serve as a service for interacting with the Microsoft Graph API. In this class, you will need to set up an instance of the GraphServiceClient class from the Microsoft.Graph namespace. csharp Copy code using  Microsoft.Graph;  using  Microsoft.Identity.Client;  using  System.Threading.Tasks; public   class   GraphService  {  private   readonly  GraphServiceClient _graphClient;  public GraphService ()  {  var  clientId =  "YOUR_CLIENT_ID_HERE" ;  var  clientSecret =  "YOUR_CLIENT_SECRET_HERE" ;  var  tenantId =  "YOUR_TENANT_ID_HERE" ;  var  authority =  $"https...