使用/users时属性为null,但使用/me/contacts时属性为null [英] Properties null when using /users but not when using /me/contacts

查看:74
本文介绍了使用/users时属性为null,但使用/me/contacts时属性为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

https://graph.microsoft.com/v1.0/me/contacts获取联系人时,我将获得用户的所有属性,例如:

When getting contacts from https://graph.microsoft.com/v1.0/me/contacts I get all properties for a user, ex:

{
  displayName: 'Joe Joeson',
  jobTitle: 'Administrator',
  department: 'HK',
  mobilePhone: '09823987234',
  businessPhones: '8934598743',
  mail: 'joe@mail.com',
}

但是当我获得该组织的所有用户(使用https://graph.microsoft.com/v1.0/users?$select=displayName,jobTitle,department,mobilePhone,businessPhones,mail,userType)时,同一联系人不会获得某些属性,例如:

But when I get all users of the organization (with https://graph.microsoft.com/v1.0/users?$select=displayName,jobTitle,department,mobilePhone,businessPhones,mail,userType) the same contact doesnt get some properties, ex:

{
  displayName: 'Joe Joeson',
  jobTitle: null,
  department: null,
  mobilePhone: null,
  businessPhones: null,
  mail: 'joe@mail.com',
}

为什么?它的联系方式相同吗?还是我错过了什么?我是否应该以其他方式从组织获得所有联系人?

Why? Its the same contact? Or am I missing something? Should I get all contacts from the organization in another way?

我已经确认所有属性都已在https://portal.azure.com

I have confirmed that all properties are set in https://portal.azure.com

推荐答案

/contacts/users端点返回两个不同的实体. contact实体表示当前用户的Exchange邮箱中的Outlook联系人,而user实体表示租户的Active Directory实例中的User目录对象.

The /contacts and /users endpoints return two different entities. A contact entity represents an Outlook Contact from the current user's Exchange mailbox whereas the a user entity represents an User directory object from the tenant's Active Directory instance.

之所以看到两个不同的结果,是因为您要返回两个不同的实体.第一个是Outlook/Exchange邮箱中的Joe Joeson contact,第二个是Active Directory中的Joe Joeson user.

The reason you're seeing two different results is because you're returning two different entities. The first is the Joe Joeson contact from your Outlook/Exchange mailbox and the second is the Joe Joeson user from Active Directory.

/users中看到较少信息的原因是由于您请求了Read all users' basic profiles(又名User.ReadBasic.All)作用域.此作用域只能从user资源中看到有限数量的属性:displayNamegivenNamesurnamephotomail.

The reason you're seeing less information from /users is due to your requesting the Read all users' basic profiles (aka User.ReadBasic.All) scope. This scope can only see a limited number of properties from a user resource: displayName, givenName, surname, photo, and mail.

这篇关于使用/users时属性为null,但使用/me/contacts时属性为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆