[英]Microsoft graph api returning NULL in Department field
I have given all required permissions for retrieving user info from Azure active directory like User.Read.All and User.Read but still getting Department and EmployeeId field as NULL我已授予从 Azure 活动目录(如 User.Read.All 和 User.Read)检索用户信息所需的所有权限,但仍将 Department 和 EmployeeId 字段获取为 NULL
code used:使用的代码:
public Microsoft.Graph.User GetUser(ref GraphServiceClient graphServiceClient, string UserId)
{
return graphServiceClient.Users[UserId].Request().GetAsync().Result;
}
According to the documentation both department
and employeeId
are returned only on $select
.根据文档,
department
和employeeId
仅在$select
上返回。
Use Select
method and specify those two properties.使用
Select
方法并指定这两个属性。 If you need to return more properties, they need to be specified in Select
.如果需要返回更多属性,需要在
Select
中指定。 Without using Select
, Graph API return only default set of properties.在不使用
Select
的情况下,图形 API 仅返回默认属性集。
public Microsoft.Graph.User GetUser(ref GraphServiceClient graphServiceClient, string UserId)
{
return graphServiceClient.Users[UserId]
.Request()
.Select("department,employeeId")
.GetAsync()
.Result;
}
Resources:资源:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.