通过电子邮件在不同地方获取用户

问题描述 投票:0回答:1

我需要检索在不同位置拥有电子邮件的所有用户。电子邮件可能位于

{
...
mail: "[email protected]",
...
}

{
...
otherMails: ["[email protected]"],
...
}

我尝试了类似的网址

https://graph.windows.net/mytenant.onmicrosoft.com/users?api-version=1.6&$filter=mail eq '[email protected]' or any(otherMails: mail eq '[email protected]')

但它给出错误:

"value": "')' or ',' expected at position 48 in 'mail eq '[email protected]' or any(otherMails: mail eq '[email protected]')'."
azure microsoft-graph-api
1个回答
0
投票

就我而言,我在 Graph Explorer 中运行了 MS Graph 查询,并得到了相同的错误,如下所示:

GET https://graph.microsoft.com/v1.0/users?&$filter=mail eq '[email protected]' or any(otherMails: mail eq '[email protected]')

回复:

enter image description here

为了解决该错误,我运行了以下modified查询并成功获得结果,如下所示:

GET https://graph.microsoft.com/v1.0/users?$filter=mail eq '[email protected]' or otherMails/any(mail: mail eq '[email protected]')

回复:

enter image description here

在您的情况下,当您在查询中使用不正确的语法时,发生了错误。要解决此问题,请使用以下modified查询:

GET https://graph.windows.net/mytenant.onmicrosoft.com/users?api-version=1.6&$filter=mail eq '[email protected]' or otherMails/any(mail: mail eq '[email protected]')

参考: 支持 Azure AD Graph API 的查询和分页筛选器选项 |微软

© www.soinside.com 2019 - 2024. All rights reserved.