簡體   English   中英

通過 companyName 過濾 MS Graph 不起作用

[英]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();

Azure AD 目錄對象的高級查詢功能

查詢參數自定義查詢

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM