The /beta/me/people endpoint returns a list of contacts related to the current user. This "relation" is based on things like emails, phone calls, and documents. This is why it changes depending on which user is logged in. In my case for example, my manager shows up at the top of the result but folks within the company I've never interacted with do not.
If you're looking for a pure list of contacts for a given user (i.e. their Contacts from Outlook) you can use the /me/contacts endpoint. This returns a list of Contact records from the current user's default Contacts folder in Outlook/Exchange.
If you're looking for the profile information for internal people (i.e. user accounts), this can be done using the /users endpoint. This will return all of the users within your organization.
If you're looking to get the profile information for a single user account, this can be retrieved using the /users/{id | userPrincipalName}. Generally I recommend using userPrincipalName
as it does make debugging and reviewing logs a little more human readable.
If you're looking to retrieve a single Contact from a user's Contacts folder, this can be done using the $filter query parameter. For example: me/contacts?$filter=emailAddresses/any(a:a/address eq '@domain.com')
.
If you're looking to grab a single person from the /me/people endpoint, you can do that by simply adding the id
for that user to the path: /me/people/{id}
Please note that using the beta
endpoint can result in unexpected behavior. These endpoints are available for testing but are absolutely not appropriate for production workloads.