我有以下C#代码。我正在尝试按照以下链接使用图谱API在Exchange 365中阅读电子邮件
IConfidentialClientApplication cca = ConfidentialClientApplicationBuilder
.Create("myAppId")
.WithTenantId("myTenantId")
.WithClientSecret("myClientSecret")
.Build();
ClientCredentialProvider ccp = new ClientCredentialProvider(cca);
GraphServiceClient client = new GraphServiceClient(ccp);
var users = await client.Users.Request()
.GetAsync();
我执行了它,并收到以下错误:
Microsoft.Graph.ServiceException:'代码:Authorization_RequestDenied消息:权限不足,无法完成操作。
我已经按照屏幕快照授予了mail.read和user.read权限。
有什么建议吗?
谢谢。
如您的代码所示,您使用使用应用程序权限的客户端凭证流。
如果要用于var users = await client.Users.Request().GetAsync();
列出用户,则需要设置应用程序权限之一。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句