我正在尝试过滤来自图形api的结果。我有20个用户。我想使用用户名以's‘开头的通配符进行搜索,因此所有的用户名都将来自’s‘。为此,我尝试使用odata查询
signInNames/any(x:x/ startswith(value,'s'))
因此,我正在寻找所有的用户名,名称以s开头。下面是图形函数。
var JSON2 = await SendGraphRequest("/users/", $"$filter=signInNames/any(x:x/ startswith(value,'r'))", null, HttpMethod.Get);
I have also attached json data screenshot, from i have to filter the result
提亚
发布于 2019-07-17 05:07:51
使用ODATA通过signInNames过滤用户时,/users查询表达式仅支持等于匹配。例如:
https://graph.windows.net/myorganization/users?$filter=signInNames/any(c:c/value eq '***')
如果你试图通过startswith过滤用户,你会得到如下错误: URL:
https://graph.windows.net/myorganization/users?$filter=signInNames/any(c:startswith(c/value, 'm'))
方法: GET
Response:
{
"odata.error": {
"code": "Request_UnsupportedQuery",
"message": {
"lang": "en",
"value": "value only supports equals-match. PrefixMatch is not supported."
},
"requestId": "aa3f1c9a-abec-425b-b187-a669a6d69cd9",
"date": "2019-07-17T04:55:47"
}
}
希望它是有用的。
https://stackoverflow.com/questions/56788305
复制