![](/img/trans.png)
[英]“https://graph.microsoft.com/v1.0/users” endpoint returning users with mail field as 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;
}
根據文檔, department
和employeeId
僅在$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;
}
資源:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.