[英]Is there any Filter condition for string "contains" in MS Graph API V1.0
I am using below code to find users in Department :我正在使用以下代码查找部门中的用户:
string searhString="IT Admin Onsite";
var departmentPeoples = await graphServiceClient.Users.Request().Filter($"department eq '{searchString}'").Select(u => new {
u.DisplayName,
u.MobilePhone,
u.BusinessPhones,
u.UserPrincipalName
}).GetAsync();
But, i want to search all Department which contains ,hence my searchString will be但是,我想搜索包含的所有部门,因此我的 searchString 将是
string searhString="Admin";字符串 searhString="管理员";
I have tries startswith ,but that will work only when my searchString is "IT" in the given example code.我尝试过 startswith ,但只有在给定的示例代码中我的 searchString 为“IT”时,这才有效。 How to achieve this Task?如何实现这个任务?
Please Help.请帮忙。
I'm afraid that contains
is not supported on any Microsoft Graph resources.恐怕任何 Microsoft Graph 资源都不支持contains
。
Note: The following $filter operators are not supported for Azure AD resources: ne, gt, ge, lt, le, and not.注意:Azure AD 资源不支持以下 $filter 运算符:ne、gt、ge、lt、le 和 not。 The contains string operator is currently not supported on any Microsoft Graph resources.目前,任何 Microsoft Graph 资源都不支持 contains 字符串运算符。
Currently you could get all the results and filter with the Department in your C# code.目前,您可以在 C# 代码中获取所有结果并使用部门进行过滤。
I believe @Allen Wu's answer to this may be outdated.我相信@Allen Wu 对此的回答可能已经过时。 According to this documentation contains appears to be generally supported, but it varies from endpoint to endpoint.根据本文档,包含似乎得到普遍支持,但它因端点而异。 https://docs.microsoft.com/en-us/graph/query-parameters#filter-parameter https://docs.microsoft.com/en-us/graph/query-parameters#filter-parameter
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.