简体   繁体   English

Microsoft 图 api 在部门字段中返回 NULL

[英]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 .根据文档departmentemployeeId仅在$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:资源:

Select parameter Select参数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “ https://graph.microsoft.com/v1.0/users”终结点以邮件字段为空返回用户 - “https://graph.microsoft.com/v1.0/users” endpoint returning users with mail field as null Microsoft Graph API不返回驱动器配额 - Microsoft Graph API not returning Drive quota 使用 Microsoft Graph API V1.0 时匹配部门名称的问题 - Issue in Matching Department Name while using Microsoft Graph API V1.0 无法使用 Microsoft Graph API C# 代码获取部门名称、经理等 - Unable to get Department Name , Manager etc using Microsoft Graph API C# Code 如何在Microsoft Graph API V1.0 中查找部门中的所有用户 - How to find all users in a department in Microsoft Graph API V1.0 无法获取部门名称、经理名称并仅在 Microsoft Graph 中获取有限的用户响应 API C# - Unable to get Department Name ,Manager Name and getting only limited users in response In Microsoft Graph API C# Microsoft Graph OnlineMeeting API 返回状态:NotFound (404) 错误 - Microsoft Graph OnlineMeeting API returning Status: NotFound (404) error Microsoft Graph API密码重置仅接受空密码 - Microsoft Graph API Password Reset Only Accepts Null password 在 Microsoft graph API 1.0 中始终将 passwordPolicies 设为 null - Getting passwordPolicies as null always in Microsoft graph API 1.0 Microsoft Graph API Microsoft 登录 - Microsoft Graph API Microsoft Login
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM