繁体   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