简体   繁体   English

我可以合并委托的GraphServiceClient和应用程序GraphServiceClient的权限吗?

[英]Can I merge permissions of delegated GraphServiceClient and application GraphServiceClient?

I'm trying to implement a search algorithm for our people using Microsoft Graph. 我正在尝试使用Microsoft Graph为我们的人员实现搜索算法。 What I would like to do is have 1 (not 2) instance of GraphServiceClient and use that to query People. 我想做的是拥有GraphServiceClient 1个(不是2个)实例,并使用该实例来查询People。 Then, if no search results come up, I query the Users. 然后,如果没有搜索结果出来,我查询用户。

Currently, I use the delegated GraphServiceClient instance to use the people search , and I use the other application GraphServiceClient to search Users . 当前,我使用委托的 GraphServiceClient实例进行人员搜索 ,并使用其他应用程序 GraphServiceClient 搜索Users But when I try to use the delegated GraphServiceClient to search Users, it gives me an unauthorized error. 但是,当我尝试使用委托的 GraphServiceClient搜索“用户”时,它给了我一个未授权的错误。

Both use the same App ID registered into Microsoft so why can't I just have one instance instead of having 2 different instances? 两者都使用在Microsoft中注册的相同App ID,所以为什么我不能只有一个实例而不是两个不同的实例? I've already received admin permissions to read our users. 我已经获得读取我们用户的管理员权限。 I just want to have 1 instance of Microsoft Graph. 我只想拥有1个Microsoft Graph实例。 Not 2. 不是2。

Edit: Here's the error message I get when trying to query users using a delegated GraphServiceClient instance: 编辑:这是我尝试使用委托的 GraphServiceClient实例查询用户时收到的错误消息:

Code: Authorization_RequestDenied\\nMessage: Insufficient privileges to complete the operation.\\n\\nInner error\\n 代码:Authorization_RequestDenied \\ n消息:权限不足,无法完成操作。\\ n \\ n内部错误\\ n

Found the answer. 找到了答案。 I just requested Directory.Read.All permissions from the user and I was able to access the list of Users to perform my search. 我刚刚从用户那里请求了Directory.Read.All权限,并且能够访问“用户”列表来执行搜索。

I don't even need application permissions anymore! 我什至不需要应用程序权限!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM