Reputation: 1807
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: '[email protected]',
}
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: '[email protected]',
}
Why? Its the same contact? Or am I missing something? Should I get all contacts from the organization in another way?
I have confirmed that all properties are set in https://portal.azure.com
Upvotes: 4
Views: 2191
Reputation: 33114
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.
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.
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
.
Upvotes: 4