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

MS Graph API含加号的用户名查询失败问题求助

MS Graph API 查询含加号的用户账户失败问题
  • 通过用户ID查询用户账户可正常运行
  • 通过含加号的issuerAssignedId查询时失败,若issuerAssignedId不含加号,相同请求可正常执行

正常执行的请求

curl --location 'https://graph.microsoft.com/beta/users?%24filter=id%20eq%20%278159db30-d3d4-489b-acf4-c6712c2c83ee%27'

执行失败的请求(含加号)

curl --location 'https://graph.microsoft.com/beta/users?%24filter=identities%2Fany(a%3Ac%2FissuerAssignedId%20eq%20%27test%2Btest1%40gmail.com%27%20and%20a%2Fissuer%20eq%20%27B2CQAFORD.onmicrosoft.com%27)'

问题原因与解决办法

原因

  1. 加号+在URL中会被默认解析为空格,导致实际查询的issuerAssignedId变为test test1@gmail.com,与目标值不匹配,查询失败。
  2. 原请求中a%3Ac是语法错误,应为a%3Aa才能正确遍历identities数组。

解决办法

将issuerAssignedId中的加号替换为URL编码值%2B,同时修正遍历语法,修改后的请求如下:

curl --location 'https://graph.microsoft.com/beta/users?%24filter=identities%2Fany(a%3Aa%2FissuerAssignedId%20eq%20%27test%252Btest1%40gmail.com%27%20and%20a%2Fissuer%20eq%20%27B2CQAFORD.onmicrosoft.com%27)'

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.26 01:40:06