简体   繁体   English

在 Microsoft Azure 上筛选(搜索)(图)API

[英]Filter (searching) on Microsoft Azure (graph) API

I would like to query the Microsoft Azure AD by passing either a mobile number or a postal code.我想通过传递手机号码或邮政编码来查询 Microsoft Azure AD。 I am able to filter using the givenName using the startsWith() function but not able to search with mobile/postal code.我可以使用startsWith() function 使用givenName进行过滤,但无法使用手机/邮政编码进行搜索。

My request is users?$filter=postalCode%20eq%20'560036'&api-version=1.6我的要求是users?$filter=postalCode%20eq%20'560036'&api-version=1.6

and getting the response:并得到回应:

{
  "odata.error": {
    "code": "Request_UnsupportedQuery",
    "message": {
      "lang": "en",
      "value": "Unsupported or invalid query filter clause specified for property 'postalCode' of resource 'User'."
    }
  }
}

According to this old post in Microsoft Developer you can add OR clause to filter more than one field if you use startsWith() function. 根据Microsoft Developer中的这篇旧帖子 ,如果使用startsWith()函数,可以添加OR子句来过滤多个字段。

users?$filter=startswith(postalCode, '560036') OR startswith(mobileNumber, '123456')

Of course, you still have to encode equal sign, parenthesis and spaces 当然,您仍然需要编码等号,括号和空格

My issue was that I was trying this on an Azure AD B2C tenant.我的问题是我在 Azure AD B2C租户上尝试这个。 This is not supported on this type of tenant.此类租户不支持此功能。 I've missed the note in the docs about this: https://learn.microsoft.com/en-us/graph/aad-advanced-queries?tabs=http我错过了文档中关于此的注释: https://learn.microsoft.com/en-us/graph/aad-advanced-queries?tabs=http

The note's text is below:笔记正文如下: 在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Blazor WASM 使用 Azure AD B2C 无法调用 Microsoft.Graph api - Blazor WASM using Azure AD B2C fails calling Microsoft.Graph api Azure 从 API 调用 Microsoft Graph 时 AD B2C 重置密码选项 - Azure AD B2C reset password options when calling Microsoft Graph from an API Microsoft Graph API 应用程序 Collections - Microsoft Graph API Application Collections 使用 azure 逻辑应用从共享邮箱发送 email 使用 Microsoft Graph API - Send email using Microsoft Graph API from shared mailbox using azure logic app Microsoft Graph API - 用户增量查询挑战 - Microsoft Graph API - User Delta Query Challenges MS Graph API 过滤器 forceChangePasswordNextSignIn - MS Graph API filter on forceChangePasswordNextSignIn Microsoft Graph API 获取所有电话号码 - Microsoft Graph API get all phonenumbers 通过 Microsoft graph 检索用户图像 api - Retrieving the image of a user through Microsoft graph api 尝试通过调用 Microsoft Graph API - /applications 将 Azure 虚拟桌面 RBAC 中定义的委派权限范围添加到 AAD 应用程序注册 - Trying to add delegated permission scopes defined in Azure Virtual Desktop RBAC to AAD App registration by calling Microsoft Graph API - /applications SharePoint - Microsoft Graph API:子网站列表为空 - SharePoint - Microsoft Graph API: subsites list is empty
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM