Код: Выделить всё
var myself = await _graphServiceClient.Me.GetAsync(); // This Code Works
var user = await _graphServiceClient.Users.GetAsync(c =>
{
c.QueryParameters.Select = new[] { "mail" };
c.QueryParameters.Top = 1;
c.QueryParameters.Filter = $"mail eq {userEmail}";
})!.Value?.FirstOrDefault(); // This doesn't work
Вот мои настройки в appsettings. json
Код: Выделить всё
"GraphApi": {
"BaseUrl": "https://graph.microsoft.com/v1.0",
"Scopes": "User.Read.All"
}
[img]https://i.sstatic. net/jzDd4.png[/img]
Вот мой код во время настройки
Код: Выделить всё
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApp(Configuration)
.AddMicrosoftGraph(Configuration.GetSection("GraphApi"))
.AddInMemoryTokenCaches();
Подробнее здесь: https://stackoverflow.com/questions/766 ... -graph-api