c# - How can I specify WithAppOnly() globally for a GraphServiceClient, so I don't have to specify it for every single M

admin2025-04-20  0

How can I specify WithAppOnly() globally for a GraphServiceClient, so I don't have to specify it for every single Microsoft Graph request?

Consider the following code:

var c = app.Services.GetRequiredService<GraphServiceClient>();
await c.Users.GetAsync(r => r.Options.WithAppOnly());

The WithAppOnly() instructs the GraphServiceClient to use app-only permissions for Microsoft Graph instead of user permissions.

I wish to specify this globally for the GraphServiceClient, so I don't have to specify it for each request. Is this possible?

#calling-a-web-api-from-a-daemon-application

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745123891a286311.html

最新回复(0)