Facing issue with MS Graph send email through delegated permission and service account

48 views Asked by At


  IPublicClientApplication publicClientApplication = PublicClientApplicationBuilder
        .Create("ClientId")
        .WithTenantId("TenantId")
        .Build();
  UsernamePasswordProvider authProvider = new UsernamePasswordProvider(publicClientApplication);
  GraphServiceClient _graphClient = new GraphServiceClient(authProvider);

await _graphClient.Me
      .SendMail(message, true)
       .Request().WithUsernamePassword("ServiceAccountUser", "ServiceAccountUserPassword")
      .PostAsync().ConfigureAwait(false);

Added permission:

enter image description here

Graph SDK: 4

Error: The given key 'Microsoft.Graph.AuthenticationHandlerOption' was not present in the dictionary.

Can someone please help me to understnad this issue?

0

There are 0 answers