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

How can I specify WithAppOnly() globally for a GraphServiceClient, so I don't have to specify it f

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745123890a4612577.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信