Azure AD B2C图api-如何获取所有组的用户 [英] Azure AD B2C Graph Api - how to get users with all groups

查看:84
本文介绍了Azure AD B2C图api-如何获取所有组的用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的一个仪表板,我想显示所有用户及其(安全)组.

For one of my dashboards, I want to show all the users and their (security) groups.

我可以很好地调用Graph API(myorganization/usersmyorganization/groups)并使用OData查询过滤器对其进行查询,但是问题出在扩展上.

I can call the Graph API just fine (myorganization/users and myorganization/groups) and query it with the OData query filters, but the problem lies in the expanding.

当我使用GET /myorganisation/users&expand=memberOf时,出现内部服务器错误. (尝试了1.0、1.6和beta API版本)

When I use GET /myorganisation/users&expand=memberOf I get an internal server error. (tried both the 1.0, 1.6 and beta API version)

当我使用GET /myorganization/groups&expand=members时,我得到了正确的响应,但是扩展成员的列表中最多包含20个条目(由于Graph API的限制)

When I use GET /myorganization/groups&expand=members I get a proper response, but the expanded member's list has a maximum of 20 entries (due to Graph API limits)

这带来了一个问题,因为我不想让所有成员都一个个地遍历他们的帐户来获得他们的组.这将花费太长时间(恐怕),并且会使我的应用程序非常聊天(对于屏幕上的20个用户,这意味着21个API调用).

This poses a problem as I don't want to get all members and loop through their accounts one by one to get their groups. This will take too long (I'm afraid) and will make my application VERY chatting (for 20 users on the screen this means 21 API calls).

我希望获得有关如何执行此操作的指导.

I'd love some guidance on how to do this.

推荐答案

未提供此类API,因此它将无法正常工作.

No such API is provided, so it won't work.

GET /myorganisation/users&expand=memberOf

MemberOf上的图形api是针对特定用户的,而不是针对特定用户的(如果要通过此方式获取用户列表的memberof,则需要首先获取用户列表并逐一请求memberOf).

The graph api on MemberOf is for specific user but not for users(if you want to get the memberof for user list by this, you need to get the user list first and request the memberOf one by one).

GET https://graph.microsoft.com/users/{id | userPrincipalName}/memberOf

当我使用GET/myorganization/groups&andexpand = members时,我得到了一个适当的 响应,但扩展的成员列表最多包含20个条目 (由于Graph Api限制)

When I use GET /myorganization/groups&expand=members I get a proper response, but the expanded members list has a maximum of 20 entries (due to Graph Api limits)

对于设计问题,您需要遵循它,或者只是在 UserVoice .

For by design issue, you need to follow it or just submit an feature request for improvement on the UserVoice.

摘要: 当前,获取用户列表,然后调用Memberof api是满足您要求的唯一方法. 为了提高性能,您不需要获得所有用户,而只需使用top/skip来实现分页(这对于大多数应用程序设计来说都是不错的UX).

Summary: Currently, get the user list and then call the Memberof api is the only way for your requirement. For performance, you don't need to get all user but use top/skip to implement paging(This is good UX for most App Design).

这篇关于Azure AD B2C图api-如何获取所有组的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆