You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于Graph API的AADB2C:如何按嵌套identities集合筛选用户?

解决Graph API筛选signInType为emailAddress用户的问题

问题背景

调用Graph API的v1.0版本查询用户时,使用$select=displayName,accountEnabled,id,identities能获取包含identities嵌套集合的结果,但添加筛选条件$filter=identities/any(id:id/signInType eq 'emailAddress')后返回Request_BadRequest错误,提示不支持的属性或操作,核心原因是v1.0版本不支持对identities集合执行此类筛选操作。

正确解决方案

使用Microsoft Graph API的beta版本执行筛选,beta版本支持对identities集合使用any操作符进行条件过滤。

有效请求示例

GET https://graph.microsoft.com/beta/users?$select=displayName,accountEnabled,id,identities&$filter=identities/any(id: id/signInType eq 'emailAddress')

注意事项

  • beta版本的API功能可能存在变动,不建议直接用于生产环境,若需在生产环境使用,需持续关注v1.0版本的更新公告,确认该筛选功能是否已正式纳入稳定版。
  • 确保调用API的应用已获取足够权限(如User.Read.All),才能正常执行用户列表查询操作。

内容的提问来源于stack exchange,提问作者realmikep

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 10:02:35