![](/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.