Akhil Tyagi
Akhil Tyagi

Reputation: 81

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



  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?

Upvotes: 0

Views: 84

Answers (0)

Related Questions