Partilhar via


Office 365 Developer: Using People API with Microsoft Graph v1.0

Microsoft Graph provides access to useful people data. You can use the person resource and the People API to aggregate information about a person from across mail, contacts, and social networks. The results are ordered by their relevance based on multiple communication and collaboration patterns and business relationships. The API lets you browse, sort, select, filter, or search for persons based on your criteria. Now the People API is available in Microsoft Graph v1.0.

To learn more about how to use the People API in v1.0, see our reference documentation and the article Get information about relevant people.

This API now requires one of two scopes: People.Read or People.Read.All.

So i went ahead, played with People API against my test Office 365 mailbox. I see the following:

Request:

GET V1.0
https://graph.microsoft.com/v1.0/users('{b0386fe0-30d5-4e1d-b1ad-55bf082db9b8}')/people

Response:

{
     "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('%7Bb0386fe0-30d5-4e1d-b1ad-55bf082db9b8%7D')/people",
     "value": [
         {
             "id": "b0386fe0-30d5-4e1d-b1ad-55bf082db9b8",
             "displayName": "Melissa Darrow",
             "givenName": "Melissa",
             "surname": "Darrow",
             "birthday": "",
             "personNotes": "",
             "isFavorite": false,
             "jobTitle": "Marketing Director",
             "companyName": null,
             "yomiCompany": "",
             "department": "Sales & Marketing",
             "officeLocation": "131/1105",
             "profession": "",
             "userPrincipalName": "MelissaD@CIE493742.onmicrosoft.com",
             "imAddress": "sip:melissad@cie493742.onmicrosoft.com",
             "scoredEmailAddresses": [
                 {
                     "address": "MelissaD@CIE493742.onmicrosoft.com",
                     "relevanceScore": 1
                 }
             ],
             "phones": [
                 {
                     "type": "mobile",
                     "number": "+1 206 555 0110"
                 }
             ],
             "postalAddresses": [],
             "websites": [],
             "personType": {
                 "class": "Person",
                 "subclass": "OrganizationUser"
             }
         }
     ]

}

Still if you’re interested, you can go ahead and test the following as well:

Get a collection of relevant people

GET https://graph.microsoft.com/v1.0/me/people/

Request a subsequent page of people

GET https://graph.microsoft.com/v1.0/me/people/?$top=3&$skip=10

Sort the response

GET https://graph.microsoft.com/v1.0/me/people/?$orderby=displayName

Select the fields to return

GET https://graph.microsoft.com/v1.0/me/people/?$select=displayName,scoredEmailAddresses

Test123

Hope this helps Smile

Comments

  • Anonymous
    August 22, 2017
    Sure, this article helps, thank you!!
    • Anonymous
      August 25, 2017
      I am glad that the article helped :)