簡體   English   中英

Microsoft 圖 api 在部門字段中返回 NULL

[英]Microsoft graph api returning NULL in Department field

我已授予從 Azure 活動目錄(如 User.Read.All 和 User.Read)檢索用戶信息所需的所有權限,但仍將 Department 和 EmployeeId 字段獲取為 NULL

使用的代碼:

public Microsoft.Graph.User GetUser(ref GraphServiceClient graphServiceClient, string UserId)
    {
        return graphServiceClient.Users[UserId].Request().GetAsync().Result;

    }

根據文檔departmentemployeeId僅在$select上返回。

使用Select方法並指定這兩個屬性。 如果需要返回更多屬性,需要在Select中指定。 在不使用Select的情況下,圖形 API 僅返回默認屬性集。

public Microsoft.Graph.User GetUser(ref GraphServiceClient graphServiceClient, string UserId)
{
    return graphServiceClient.Users[UserId]
             .Request()
             .Select("department,employeeId")
             .GetAsync()
             .Result;
}

資源:

Select參數

暫無
暫無

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

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