将 endsWith 过滤器与扩展用户的 memberOf 一起使用不起作用

Using endsWith filter together with expanding user's memberOf doesn't work

我想从 MS Graph API 中获取所有用户及其组名。 只要我不想做一些高级过滤,它就可以工作 (endsWith())。

这是 select 查询,我是 运行:

https://graph.microsoft.com/v1.0/users?$select=displayName,userPrincipalName,mail,id,givenName,surname,memberOf&$expand=memberOf($select=displayName)

它生成一组不错的用户以及他们所在组的显示名称。 我想将结果限制为特定的邮件域(我添加了 ConsistencyLevel: eventual),但是我无法做到这一点,除非我删除 memberOf 展开。这有效:

https://graph.microsoft.com/v1.0/users?$select=displayName,userPrincipalName,mail,id,givenName,surname,memberOf&$count=true&$filter=endsWith(mail,'@somedomain.com')

但是不出所料,没有组。事实上,尽管有 selecting memberOf,但根本没有任何群组!我想我会先获取组,然后在我的代码中将它们配对,但要获得它们我必须扩展,并且扩展过滤器不起作用!

这会产生 Request_UnsupportedQuery 错误:

https://graph.microsoft.com/v1.0/users?$select=displayName,userPrincipalName,mail,id,givenName,surname,memberOf&$expand=memberOf($select=displayName)&$count=true&$filter=endsWith(mail,'@somedomain.com')

有没有什么方法可以实现我想要的,而无需手动过滤或自行发出多个请求和映射内容?我们谈论的是包含数万用户的目录。Graph 一开始似乎不错,但当我想做任何更复杂的事情时,它变成了一个有限的 POS,其中一个查询完全排除了另一个。我也无法以任何方式通过扩展的 memberOf 进行过滤

基于Microsoft Docs

高级查询目前不支持 $expand。