windows form calling graph api, Server error: User lookup by user id failed in AAD

Viewed 62

My goal is to call graph api using some workflows. Right now I am trying to practice using a windows form. I registered the app with Azure and got appId, TenentId and Secret.

new GraphServiceClient(
         new DelegateAuthenticationProvider(
          async (requestMessage) =>
         {
                IConfidentialClientApplication client = ConfidentialClientApplicationBuilder
               .Create(clientId)
               .WithTenantId(tenantId)
               .WithClientSecret(clientSecret)                 
               .Build();
               var result = await client.AcquireTokenForClient(scopes).ExecuteAsync();
               requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", 
                                                           result.AccessToken);
         }));

When I call:

newonlineMeeting = await graphServiceClient.Me.OnlineMeetings
                   .Request()
                   .AddAsync(onlineMeeting);

I got "User lookup by user id failed in AAD" error. Do I still need to use username and password to login first? Please help. Thanks Holly

0 Answers
Related