![](/img/trans.png)
[英]Variable interpolation issue in finding users in MS Graph API v1.0
[英]Is there any Filter condition for string "contains" in MS Graph API V1.0
我正在使用以下代碼查找部門中的用戶:
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();
但是,我想搜索包含的所有部門,因此我的 searchString 將是
字符串 searhString="管理員";
我嘗試過 startswith ,但只有在給定的示例代碼中我的 searchString 為“IT”時,這才有效。 如何實現這個任務?
請幫忙。
恐怕任何 Microsoft Graph 資源都不支持contains
。
在此處查看詳細信息。
注意:Azure AD 資源不支持以下 $filter 運算符:ne、gt、ge、lt、le 和 not。 目前,任何 Microsoft Graph 資源都不支持 contains 字符串運算符。
目前,您可以在 C# 代碼中獲取所有結果並使用部門進行過濾。
我相信@Allen Wu 對此的回答可能已經過時。 根據本文檔,包含似乎得到普遍支持,但它因端點而異。 https://docs.microsoft.com/en-us/graph/query-parameters#filter-parameter
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.