[英]MS Graph filtering by companyName doesn't work
我有兩個類似的片段:
IGraphServiceUsersCollectionPage users = await graphServiceClient.Users
.Request()
.Select("id")
.Filter("department eq 'Department'")
.GetAsync();
和
IGraphServiceUsersCollectionPage users = await graphServiceClient.Users
.Request()
.Select("id")
.Filter("companyName eq 'CompanyName'")
.GetAsync();
第一個片段正常工作; 第二個片段根本不起作用。
我通過 HTTP GET 直接請求成功
https://graph.microsoft.com/beta/users?ConsistencyLevel=eventual&$count=true&$filter=companyName eq 'Company'
所以現在我有一個問題:如何在 C# 中使用 MSGraph API 來做到這一點?
要將 $count=true 添加到您的查詢中,您應該使用QueryOption
var options = new List<QueryOption>();
options.Add(new QueryOption("$count", "true"));
IGraphServiceUsersCollectionPage users = await graphServiceClient.Users
.Request(options)
.Select("id")
.Filter("companyName eq 'CompanyName'")
.GetAsync();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.