Utiliser l’API Contacts dans Microsoft Graph pour obtenir des informations sur les contacts plus pertinents pour vousUse the People API in Microsoft Graph to get information about the people most relevant to you

Les applications Microsoft Graph peuvent utiliser l’API Contacts pour récupérer les contacts les plus pertinents pour un utilisateur. La pertinence est déterminée par les relations professionnelles, ainsi que les modèles de communication et de collaboration de l’utilisateur. Il peut s’agir de contacts locaux, de contacts provenant de réseaux sociaux ou de l’annuaire d’une organisation, et de contacts issus de communications récentes (messagerie électronique et Skype, par exemple). En plus de la génération de ces informations, l’API Contacts prend également en charge la recherche analogique et la possibilité de récupérer la liste des utilisateurs pertinents pour un autre utilisateur de l’organisation de l’utilisateur de connecté. L’API Contacts est particulièrement utile pour les scénarios de sélection d’utilisateurs, comme la composition d’un courrier électronique ou la création d’une réunion. Par exemple, vous pouvez utiliser l’API Contacts dans des scénarios de composition de courrier électronique.Microsoft Graph applications can use the People API to retrieve the people who are most relevant to a user. Relevance is determined by the user’s communication and collaboration patterns and business relationships. People can be local contacts, contacts from social networking or from an organization’s directory, and people from recent communications (such as email and Skype). Along with generating this insight, the People API also provides fuzzy matching search support and the ability to retrieve the list of users relevant to another user in the signed-in user's organization. The People API is particularly useful for people picking scenarios, such as composing an email or creating a meeting. For example, you can use the People API in email compose scenarios.

AutorisationAuthorization

Pour appeler l’API Contacts dans Microsoft Graph, votre application aura besoin des autorisations appropriées :To call the People API in Microsoft Graph, your app will need the appropriate permissions:

  • People.Read : permet d’effectuer des appels d’API Contacts généraux ; par exemple, https://graph.microsoft.com/v1.0/me/people/. People.Read requiert le consentement de l’utilisateur final.People.Read - Use to make general People API calls; for example, https://graph.microsoft.com/v1.0/me/people/. People.Read requires end user consent.
  • People.Read.All : nécessaire pour récupérer les contacts les plus pertinents pour un utilisateur spécifié dans les appels (https://graph.microsoft.com/v1.0/users/{id}/people) d’organisation de l’utilisateur connecté.People.Read.All - Required to retrieve the people most relevant to a specified user in the signed-in user’s organization (https://graph.microsoft.com/v1.0/users/{id}/people) calls. People.Read.All requiert le consentement de l’administrateur.People.Read.All requires admin consent.

Parcourir les contactsBrowse people

Les demandes de cette section obtiennent les contacts plus pertinents pour l’utilisateur connecté (/me) ou un utilisateur spécifique dans l’organisation de l’utilisateur connecté. Ces demandes requièrent l’autorisation People.Read ou People.Read.All, respectivement. Par défaut, chaque réponse renvoie 10 enregistrements, mais vous pouvez modifier cette valeur à l’aide du paramètre de requête $top.The requests in this section get the people most relevant to the signed-in user (/me), or to a specific user in the signed-in user’s organization. These requests require the People.Read or People.Read.All permission respectively. By default, each response returns 10 records, but you can change this by using the $top query parameter.

Obtenir une collection de contacts pertinentsGet a collection of relevant people

La demande suivante obtient les contacts les plus pertinents pour l’utilisateur connecté (/me), en fonction des relations professionnelles, ainsi que des modèles de communication et de collaboration.The following request gets the people most relevant to the signed-in user (/me), based on communication and collaboration patterns and business relationships.

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

L’exemple suivant illustre la réponse. Par défaut, chaque réponse renvoie 10 enregistrements. Vous pouvez modifier ceci à l’aide du paramètre de requête $top. Cet exemple utilise $top afin de limiter la réponse à trois enregistrements.The following example shows the response. By default, each response returns 10 records. You can change this by using the $top query parameter. This example uses $top to limit the response to three records.

HTTP/1.1 200 OK
Content-type: application/json

{
  "value": [
    {
      "id": "8CE6E1DE-CB84-4BF5-971D-D3ECF452E2B5",
      "displayName": "Lorrie Frye",
      "givenName": "Lorrie",
      "surname": "Frye",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "Paralegal",
      "companyName": null,
      "yomiCompany": "",
      "department": "Legal",
      "officeLocation": "20/1109",
      "profession": "",
      "userPrincipalName": "LorrieF@contoso.onmicrosoft.com",
      "imAddress": "sip:LorrieF@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "LorrieF@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 980 555 0101"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    },
    {
      "id": "5767393D-42BA-4E5C-BEE4-52BB25639CF4",
      "displayName": "Maynard Denman",
      "givenName": "Maynard",
      "surname": "Denman",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "Web Marketing Manager",
      "companyName": null,
      "yomiCompany": "",
      "department": "Sales & Marketing",
      "officeLocation": "20/1101",
      "profession": "",
      "userPrincipalName": "MaynardD@contoso.onmicrosoft.com",
      "imAddress": "sip:MaynardD@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "MaynardD@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 918 555 0101"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    },
    {
      "id": "914B5191-11FA-4C0B-A354-0FA8C8EFD585",
      "displayName": "Darrel Halsey",
      "givenName": "Darrel",
      "surname": "Halsey",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "Attorney",
      "companyName": null,
      "yomiCompany": "",
      "department": "Legal",
      "officeLocation": "14/1102",
      "profession": "",
      "userPrincipalName": "DarrelH@contoso.onmicrosoft.com",
      "imAddress": "sip:DarrelH@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "DarrelH@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 205 555 0103"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    }
  ]
}

Demander une autre page de contactsRequest a subsequent page of people

Si la première réponse ne contient pas la liste complète des contacts pertinents, vous pouvez effectuer une deuxième demande à l’aide de $top et $skip pour demander des pages d’information supplémentaires. Si la demande précédente comporte des informations supplémentaires, la demande suivante obtient la page suivante des contacts auprès du serveur.If the first response does not contain the complete list of relevant people, you can make a second request using $top and $skip to request additional pages of information. If the previous request has additional information, the following request gets the next page of people from the server.

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

L’exemple suivant illustre la réponse. Par défaut, chaque réponse renvoie 10 enregistrements. Vous pouvez modifier ceci à l’aide du paramètre de requête $top. Cet exemple utilise $top afin de limiter la réponse à trois enregistrements.The following example shows the response. By default, each response returns 10 records. You can change this by using the $top query parameter. This example uses $top to limit the response to three records.

HTTP/1.1 200 OK
Content-type: application/json

{
  "value": [
    {
      "id": "1F28616D-BDFE-4080-8F06-03366A851688",
      "displayName": "Felix Coppola",
      "givenName": "Felix",
      "surname": "Coppola",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "CVP Legal",
      "companyName": null,
      "yomiCompany": "",
      "department": "Legal",
      "officeLocation": "19/2109",
      "profession": "",
      "userPrincipalName": "FelixC@contoso.onmicrosoft.com",
      "imAddress": "sip:FelixC@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "FelixC@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 309 555 0104"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    },
    {
      "id": "8A3FC021-6DBB-44AC-8884-B7B500CC260A",
      "displayName": "Lenora Rowland",
      "givenName": "Lenora",
      "surname": "Rowland",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "Marketing Assistant",
      "companyName": null,
      "yomiCompany": "",
      "department": "Sales & Marketing",
      "officeLocation": "18/1106",
      "profession": "",
      "userPrincipalName": "LenoraR@contoso.onmicrosoft.com",
      "imAddress": "sip:LenoraR@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "LenoraR@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 954 555 0118"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    },
    {
      "id": "032C9919-4DF9-4715-8C46-4D0FAE7B3EB2",
      "displayName": "Manuel Collette",
      "givenName": "Manuel",
      "surname": "Collette",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "Accountant II",
      "companyName": null,
      "yomiCompany": "",
      "department": "Finance",
      "officeLocation": "98/2202",
      "profession": "",
      "userPrincipalName": "ManuelC@contoso.onmicrosoft.com",
      "imAddress": "sip:ManuelC@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "ManuelC@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+20 255501070"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    }
  ]
}

Trier la réponseSort the response

Par défaut, les contacts de la réponse sont triés selon leur pertinence pour votre requête. Vous pouvez modifier l’ordre des contacts dans la réponse à l’aide du paramètre $orderby. Cette requête sélectionne les contacts les plus pertinents pour vous, les trie par nom complet (displayName), puis renvoie les 10 premiers contacts dans la liste triée.By default, the people in the response are sorted by their relevance to your query. You can change the order of the people in the response by using the $orderby parameter. This query selects the people most relevant to you, sorts them by their displayName, and then returns the first 10 people on the sorted list.

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

L’exemple suivant illustre la réponse. Par défaut, chaque réponse renvoie 10 enregistrements. Vous pouvez modifier ceci à l’aide du paramètre $top. L’exemple suivant utilise $top afin de limiter la réponse à trois enregistrements.The following example shows the response. By default, each response returns 10 records. You can change this by using the $top parameter. The following example uses $top to limit the response to three records.

HTTP/1.1 200 OK
Content-type: application/json

{
  "value": [
    {
      "id": "818E29A1-E6BB-4EDA-AB20-8230B4B1E290",
      "displayName": "Adriana Ramos",
      "givenName": "Adriana",
      "surname": "Ramos",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "Product Marketing Manager",
      "companyName": null,
      "yomiCompany": "",
      "department": "Sales & Marketing",
      "officeLocation": "18/2111",
      "profession": "",
      "userPrincipalName": "AdrianaR@contoso.onmicrosoft.com",
      "imAddress": "sip:AdrianaR@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "AdrianaR@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 425 555 0109"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    },
    {
      "id": "62633BAA-1CB9-4FA2-9B8F-55AB1840B69D",
      "displayName": "Alyce Cooley",
      "givenName": "Alyce",
      "surname": "Cooley",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "Marketing Assistant",
      "companyName": null,
      "yomiCompany": "",
      "department": "Sales & Marketing",
      "officeLocation": "131/1104",
      "profession": "",
      "userPrincipalName": "AlyceC@contoso.onmicrosoft.com",
      "imAddress": "sip:AlyceC@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "AlyceC@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 858 555 0110"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    },
    {
      "id": "6BB54D2C-EF20-48DA-ADD9-AE757DD30C4E",
      "displayName": "Alyssa Clarke",
      "givenName": "Alyssa",
      "surname": "Clarke",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "Corporate Security Officer",
      "companyName": null,
      "yomiCompany": "",
      "department": "Operations",
      "officeLocation": "24/1106",
      "profession": "",
      "userPrincipalName": "AlyssaC@contoso.onmicrosoft.com",
      "imAddress": "sip:AlyssaC@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "AlyssaC@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 262 555 0106"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    }
  ]
}

Modifier le nombre de contacts et de champs renvoyésChange the number of people and fields returned

Vous pouvez modifier le nombre de contacts renvoyés dans la réponse en définissant le paramètre $top.You can change the number of people returned in the response by setting the $top parameter.

L’exemple suivant demande les 1 000 contacts les plus pertinents pour /me. La demande limite également la quantité de données renvoyées à partir du serveur en demandant uniquement le nom complet (displayName) de la personne.The following example requests the 1,000 people most relevant to /me. The request also limits the amount of data sent back from the server by requesting only the displayName of the person.

GET https://graph.microsoft.com/v1.0/me/people/?$top=1000&$Select=displayName

L’exemple suivant illustre la réponse.The following example shows the response.

HTTP/1.1 200 OK
Content-type: application/json

{
  "value": [
    {
      "id": "8CE6E1DE-CB84-4BF5-971D-D3ECF452E2B5",
      "displayName": "Lorrie Frye"
    },
    {
      "id": "5767393D-42BA-4E5C-BEE4-52BB25639CF4",
      "displayName": "Maynard Denman"
    },
    {
      "id": "914B5191-11FA-4C0B-A354-0FA8C8EFD585",
      "displayName": "Darrel Halsey"
    },
    {
      "id": "E3C5B235-DE15-4566-B7B1-7A8E32426540",
      "displayName": "Roscoe Seidel"
    },
    {
      "id": "6BB54D2C-EF20-48DA-ADD9-AE757DD30C4E",
      "displayName": "Alyssa Clarke"
    },
    {
      "id": "818E29A1-E6BB-4EDA-AB20-8230B4B1E290",
      "displayName": "Adriana Ramos"
    },
    {
      "id": "62633BAA-1CB9-4FA2-9B8F-55AB1840B69D",
      "displayName": "Alyce Cooley"
    },
    {
      "id": "6BB9CC1F-418D-4DDF-AB0C-6A1C4ABCDBF4",
      "displayName": "Wayne Leeper"
    },
    {
      "id": "E7D40AC5-0078-4575-B1F3-F738124C4BC9",
      "displayName": "Jan Travis"
    },
    {
      "id": "6F99D1CC-4FCC-49E4-9160-E8AB01BF3E83",
      "displayName": "Charlotte Delacruz"
    },
    {
      "id": "1F28616D-BDFE-4080-8F06-03366A851688",
      "displayName": "Felix Coppola"
    },
    {
      "id": "8A3FC021-6DBB-44AC-8884-B7B500CC260A",
      "displayName": "Lenora Rowland"
    },
    {
      "id": "032C9919-4DF9-4715-8C46-4D0FAE7B3EB2",
      "displayName": "Manuel Collette"
    }
  ]
}

Types de résultats inclusTypes of results included

Par défaut, la recherche de Microsoft Graph s’effectue uniquement sur la boîte aux lettres. Elle ne s’effectue pas au niveau du répertoire de l’organisation.By default, Microsoft Graph serves mailbox-only results, which do not include directory/organization results. Si vous souhaitez que Microsoft Graph effectue une recherche au niveau du répertoire, spécifiez un en-tête HTTP, comme indiqué ci-dessous.To retrieve directory results, specify an HTTP header, as shown.

"X-PeopleQuery-QuerySources: Mailbox,Directory”

Sélectionne les champs à renvoyerSelect the fields to return

Vous pouvez limiter la quantité de données renvoyées à partir du serveur en utilisant le paramètre $select pour choisir un ou plusieurs champs. Le champ @odata.id est toujours renvoyé.You can limit the amount of data returned from the server by using the $select parameter to choose one or more fields. The @odata.id field is always returned.

L’exemple suivant limite la réponse au nom complet (displayName) et aux adresses e-mail notées (scoredEmailAddresses) des 10 contacts les plus pertinents.The following example limits the response to the displayName and scoredEmailAddresses of the 10 most relevant people.

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

L’exemple suivant illustre la réponse. Par défaut, chaque réponse renvoie 10 enregistrements. Vous pouvez modifier ceci à l’aide du paramètre $top. Cet exemple utilise $top afin de limiter la réponse à trois enregistrements.The following example shows the response. By default, each response returns 10 records. You can change this using the $top parameter. This example uses $top to limit the response to three records.

HTTP/1.1 200 OK
Content-type: application/json

{
  "value": [
    {
      "id": "8CE6E1DE-CB84-4BF5-971D-D3ECF452E2B5",
      "displayName": "Lorrie Frye",
      "scoredEmailAddresses": [
        {
          "address": "LorrieF@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ]
    },
    {
      "id": "5767393D-42BA-4E5C-BEE4-52BB25639CF4",
      "displayName": "Maynard Denman",
      "scoredEmailAddresses": [
        {
          "address": "MaynardD@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ]
    },
    {
      "id": "914B5191-11FA-4C0B-A354-0FA8C8EFD585",
      "displayName": "Darrel Halsey",
      "scoredEmailAddresses": [
        {
          "address": "DarrelH@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ]
    }
  ]
}

Utiliser un filtre pour limiter la réponseUse a filter to limit the response

Vous pouvez utiliser le paramètre $filter pour limiter la réponse uniquement aux contacts dont l’enregistrement contient les critères spécifiés.You can use the $filter parameter to limit the response to only those people whose record contains the specified criteria.

La demande suivante limite la réponse aux instances person dont la propriété personType comporte person en tant que classe (class) et organizationUser en tant que sous-classe (subclass).The following query limits the response to person instances with the personType property being assigned person as class and organizationUser as subclass.

GET https://graph.microsoft.com/v1.0/me/people/?$filter=personType/class eq 'Person' and personType/subclass eq 'OrganizationUser'

L’exemple suivant illustre la réponse. Par défaut, chaque réponse renvoie 10 enregistrements. Vous pouvez modifier ceci à l’aide du paramètre $top. Cet exemple utilise $top afin de limiter la réponse à trois enregistrements.The following example shows the response. By default, each response returns 10 records. You can change this using the $top parameter. This example uses $top to limit the response to three records.

HTTP/1.1 200 OK
Content-type: application/json

{
  "value": [
    {
      "id": "8CE6E1DE-CB84-4BF5-971D-D3ECF452E2B5",
      "displayName": "Lorrie Frye",
      "givenName": "Lorrie",
      "surname": "Frye",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "Paralegal",
      "companyName": null,
      "yomiCompany": "",
      "department": "Legal",
      "officeLocation": "20/1109",
      "profession": "",
      "userPrincipalName": "LorrieF@contoso.onmicrosoft.com",
      "imAddress": "sip:LorrieF@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "LorrieF@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 980 555 0101"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    },
    {
      "id": "5767393D-42BA-4E5C-BEE4-52BB25639CF4",
      "displayName": "Maynard Denman",
      "givenName": "Maynard",
      "surname": "Denman",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "Web Marketing Manager",
      "companyName": null,
      "yomiCompany": "",
      "department": "Sales & Marketing",
      "officeLocation": "20/1101",
      "profession": "",
      "userPrincipalName": "MaynardD@contoso.onmicrosoft.com",
      "imAddress": "sip:MaynardD@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "MaynardD@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 918 555 0101"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    },
    {
      "id": "914B5191-11FA-4C0B-A354-0FA8C8EFD585",
      "displayName": "Darrel Halsey",
      "givenName": "Darrel",
      "surname": "Halsey",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "Attorney",
      "companyName": null,
      "yomiCompany": "",
      "department": "Legal",
      "officeLocation": "14/1102",
      "profession": "",
      "userPrincipalName": "DarrelH@contoso.onmicrosoft.com",
      "imAddress": "sip:DarrelH@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "DarrelH@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 205 555 0103"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    }
  ]
}

Sélectionnez les champs à renvoyer dans une réponse filtréeSelect the fields to return in a filtered response

Vous pouvez combiner les paramètres $select et $filter pour créer une liste personnalisée de contacts pertinents pour l’utilisateur et obtenir uniquement les champs dont votre application a besoin.You can combine the $select and $filter parameters to create a custom list of people relevant to the user and get only the fields that your application needs.

L’exemple suivant obtient le nom complet (displayName) et les adresses e-mail notées (scoredEmailAddresses) des contacts dont le nom complet est identique au nom spécifié. Dans cet exemple, seuls les contacts dont le nom complet est « Lorrie Frye » sont renvoyés.The following example gets the displayName and scoredEmailAddresses of people whose display name equals the specified name. In this example, only people whose display name equals "Lorrie Frye" are returned.

GET https://graph.microsoft.com/v1.0/me/people/?$select=displayName,scoredEmailAddresses&$filter=displayName eq 'Lorrie Frye'

L’exemple suivant illustre la réponse.The following example shows the response.

HTTP/1.1 200 OK
Content-type: application/json

{
  "value": [
    {
      "id": "8CE6E1DE-CB84-4BF5-971D-D3ECF452E2B5",
      "displayName": "Lorrie Frye",
      "scoredEmailAddresses": [
        {
          "address": "LorrieF@contoso.onmicrosoft.com",
          "relevanceScore": 8
        }
      ]
    }
  ]
}

Parcourir des contacts pertinents pour un autre utilisateurBrowse another user’s relevant people

La demande suivante obtient les contacts les plus pertinents pour une autre personne de l’organisation de l’utilisateur connecté.The following request gets the people most relevant to another person in the signed-in user's organization. Cette demande requiert l’autorisation People.Read.All.This request requires the People.Read.All permission. Tous les paramètres de requête décrits dans les sections précédentes s’appliquent également.All the query parameters described in the above sections apply as well.

Dans cet exemple, les contacts pertinents pour Roscoe Seidel sont affichés.In this example, Roscoe Seidel's relevant people are displayed.

GET https://graph.microsoft.com/v1.0/users('roscoes@contoso.com')/people/

L’exemple suivant illustre la réponse. Par défaut, chaque réponse renvoie 10 enregistrements. Vous pouvez modifier ceci à l’aide du paramètre $top. L’exemple ci-dessous utilise $top afin de limiter la réponse à trois enregistrements.The following example shows the response. By default, each response returns 10 records. You can change this using the $top parameter. The example below uses $top to limit the response to three records.

HTTP/1.1 200 OK
Content-type: application/json

{
  "value": [
    {
      "id": "56155636-703F-47F2-B657-C83F01F49BBC",
      "displayName": "Clifton Clemente",
      "givenName": "Clifton",
      "surname": "Clemente",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "Director",
      "companyName": null,
      "yomiCompany": "",
      "department": "Legal",
      "officeLocation": "19/2106",
      "profession": "",
      "userPrincipalName": "CliftonC@contoso.onmicrosoft.com",
      "imAddress": "sip:CliftonC@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "CliftonC@contoso.onmicrosoft.com",
          "relevanceScore": 20
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 309 555 0101"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    },
    {
      "id": "6BF27D5A-AB4F-4C43-BED0-7DAD9EB0C1C4",
      "displayName": "Sheree Mitchell",
      "givenName": "Sheree",
      "surname": "Mitchell",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "Product Manager",
      "companyName": null,
      "yomiCompany": "",
      "department": "Sales & Marketing",
      "officeLocation": "20/2107",
      "profession": "",
      "userPrincipalName": "ShereeM@contoso.onmicrosoft.com",
      "imAddress": "sip:ShereeM@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "ShereeM@contoso.onmicrosoft.com",
          "relevanceScore": 10
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 918 555 0107"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    },
    {
      "id": "B3E5302D-EAF0-4E8B-8C6C-A2AE64B4B163",
      "displayName": "Vincent Matney",
      "givenName": "Vincent",
      "surname": "Matney",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "CVP Engineering",
      "companyName": null,
      "yomiCompany": "",
      "department": "Engineering",
      "officeLocation": "23/2102",
      "profession": "",
      "userPrincipalName": "VincentM@contoso.onmicrosoft.com",
      "imAddress": "sip:VincentM@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "VincentM@contoso.onmicrosoft.com",
          "relevanceScore": 10
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 502 555 0102"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    }
  ]
}

Rechercher des contactsSearch people

Les demandes de cette section vous permettent de rechercher des contacts pertinents pour l’utilisateur connecté (/me) et d’autres utilisateurs dans l’organisation de l’utilisateur de connecté. Ces demandes requièrent l’autorisation People.Read, à l’exception de la recherche de contacts pertinents pour d’autres utilisateurs, qui nécessite People.Read.All. Par défaut, chaque réponse renvoie 10 enregistrements, mais vous pouvez modifier ceci à l’aide du paramètre $top.The requests in this section allow you to search for people relevant to the signed-in user (/me) and other users in the signed-in user’s organization. These requests require the People.Read permission, with the exception of searching other users’ relevant people, which requires People.Read.All. By default, each response returns 10 records, but you can change this by using the $top parameter.

Utiliser la recherche pour sélectionner des contactsUse search to select people

Utilisez le paramètre $search pour sélectionner des contacts qui répondent à un ensemble de critères.Use the $search parameter to select people who meet a particular set of criteria.

La requête de recherche suivante renvoie les contacts pertinents pour /me dont le nom d’affichage displayName ou l’adresse e-mail emailAddress contient un mot commençant par la lettre « j ».The following search query returns people relevant to /me whose displayName or emailAddress has a word that begins with the letter "j".

GET https://graph.microsoft.com/v1.0/me/people/?$search=j

L’exemple suivant illustre la réponse. Par défaut, chaque réponse renvoie 10 enregistrements. Vous pouvez modifier ceci à l’aide du paramètre $top. Cet exemple utilise $top afin de limiter la réponse à trois enregistrements.The following example shows the response. By default, each response returns 10 records. You can change this using the $top parameter. This example uses $top to limit the response to three records.

HTTP/1.1 200 OK
Content-type: application/json

{
  "value": [
    {
      "id": "E3C5B235-DE15-4566-B7B1-7A8E32426540",
      "displayName": "Jan Travis",
      "givenName": "Jan",
      "surname": "Travis",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": "VP Sales",
      "companyName": null,
      "yomiCompany": "",
      "department": "Sales & Marketing",
      "officeLocation": "19/3123",
      "profession": "",
      "userPrincipalName": "JanT@contoso.onmicrosoft.com",
      "imAddress": "sip:JanT@contoso.onmicrosoft.com",
      "scoredEmailAddresses": [
        {
          "address": "JanT@contoso.onmicrosoft.com",
          "relevanceScore": -12.297347783416837
        }
      ],
      "phones": [
        {
          "type": "Business",
          "number": "+1 732 555 0102"
        }
      ],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    },
    {
      "id": "C43BF05E-5B6B-4DCF-B2FC-0837B09E0FA9",
      "displayName": "Jacob Cazares (TAILSPIN)",
      "givenName": null,
      "surname": null,
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": null,
      "companyName": null,
      "yomiCompany": "",
      "department": null,
      "officeLocation": null,
      "profession": "",
      "userPrincipalName": "",
      "imAddress": null,
      "scoredEmailAddresses": [
        {
          "address": "JacobC@tailspintoys.com",
          "relevanceScore": -12.298154282019846
        }
      ],
      "phones": [],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "PersonalContact"
      }
    },
    {
      "id": "6BB9CC1F-418D-4DDF-AB0C-6A1C4ABCDBF4",
      "displayName": "Jewell Montgomery",
      "givenName": "Jewell",
      "surname": "Montgomery",
      "birthday": "",
      "personNotes": "",
      "isFavorite": false,
      "jobTitle": null,
      "companyName": null,
      "yomiCompany": "",
      "department": null,
      "officeLocation": null,
      "profession": "",
      "userPrincipalName": "JewellM@contoso.onmicrosoft.com",
      "imAddress": null,
      "scoredEmailAddresses": [
        {
          "address": "JewellM@contoso.onmicrosoft.com",
          "relevanceScore": -12.531408487977451
        }
      ],
      "phones": [],
      "postalAddresses": [],
      "websites": [],
      "personType": {
        "class": "Person",
        "subclass": "OrganizationUser"
      }
    }
  ]
}

Les recherches implémentent un algorithme de correspondance approximative.Searches implement a fuzzy matching algorithm. Elles renvoient des résultats basés sur une correspondance exacte, ainsi que sur des inférences relatives à l’objectif de la recherche.They will return results based on an exact match and also on inferences about the intent of the search. Par exemple, imaginons que le nom d’affichage d’un utilisateur soit « Tyler Lee » et que son adresse électronique soit tylerlee@exemple.com, et qu’il se trouve dans la collection people de l’utilisateur connecté.For example, imagine a user with a display name of "Tyler Lee" and an email address of tylerle@example.com who is in the people collection of the signed-in user. Toutes les recherches suivantes renvoient l’utilisateur Tyler parmi les résultats.All of the following searches will return this user Tyler as one of the results.

GET https://graph.microsoft.com/v1.0/me/people?$search="tyler"                //matches both Tyler's name and email
GET https://graph.microsoft.com/v1.0/me/people?$search="tylerle"              //matches Tyler's email
GET https://graph.microsoft.com/v1.0/me/people?$search="tylerle@example.com"  //matches Tyler's email. Note the quotes to enclose '@'.
GET https://graph.microsoft.com/v1.0/me/people?$search="tiler"                //fuzzy match with Tyler's name
GET https://graph.microsoft.com/v1.0/me/people?$search="tyler lee"            //matches Tyler's name. Note the quotes to enclose the space.

Implémentation des fonctionnalitésWorking with feature implementation

Il doit y avoir une relation entre le propriétaire du profil et d’autres personnes pour que ces contacts s’affichent dans la liste du propriétaire du profil publique.There must be a public relationship between the profile owner and the other people in order for those people to show up on the profile owner's list. L’illustration suivante montre un utilisateur A, l’index de relations avec d’autres utilisateurs (utilisateur B) et un profil public montrant un sous-ensemble de relations utilisateur.The following illustration shows a User A, an index of relationships with other users (User B), and a public profile showing a subset of user relationships.

Image de l’utilisation des relations

Voici des exemples d'utilisation des relations publiques :The following are examples of public relationships:

  • Personnes connectées dans l’organigramme hiérarchique : manager, subordonné, collègues (partagent le même manager)Individuals connected in the org chart: Manager, Direct report, Peers (share the same manager)
  • Membres d'un groupe public ou d'une liste de distribution de moins de 30 personnes.Members of a public group or distribution list with fewer than 30 people. Les groupes publics disposent de listes de membres qui sont disponibles dans le répertoire.Public groups have membership lists that are available in the directory.

Si le propriétaire du profil communique avec une personne et qu’il n’existe aucune relation publique entre eux, par exemple, une connexion dans l’organigramme ou un groupe en commun, le fait qu’il ont été en communication ne sera pas visible pour les autres personnes.If the profile owner communicates with someone and there is no public relationship between them, such as an org chart connection or a group in common, the fact that they've been communicating will not be visible to others.

Le classement des personnes, autrement dit, l’ordre dans lequel ils apparaissent sur la page du propriétaire du profil, est déterminé par les communications publiques et privées entre le propriétaire du profil et à la personne dans la liste.The ranking of people - that is, the order in which they appear on the profile owner's page - is determined by the private and public communication between the profile owner and the person on the list.

Voici quelques exemples de communication privée :Examples of private communication include:

  • Envoi de messages électroniques où le nom de l’autre personne est dans la ligne ÀSending emails to each other where the name of the other person is in the TO line
  • Invitez des utilisateurs à des réunions en incluant son nom dans l’invitation du calendrierInviting users to meetings by including their name in the calendar invite

Voici quelques exemples d’interaction publique :Examples of public interaction include:

  • Envoyer ou recevoir des messages électroniques dans le cadre d’un groupe publicSending or receiving emails to/from each other as part of a public group
  • Inviter des utilisateurs à des réunions dans le cadre du groupe, ou si plus d’un certain nombre X de personnes sont invitéesInviting users to meetings as part of group, or where more than X people are invited

Le classement ne change pas selon qui est l’utilisateur A (la personne consultant la page d’une autre personne).The ranking doesn’t change based on who User A is (the person looking at someone else's page). Le classement est déterminé par le niveau d’interaction entre l’utilisateur B (le propriétaire de profil) et l’utilisateur C (la personne apparaissant dans la liste du propriétaire du profil).The ranking is determined by the interaction level between User B (profile owner) and User C (person showing up on profile owner's list).

Pour que l’utilisateur C puisse apparaitre, le propriétaire du profil et cet utilisateur doivent appartenir à un groupe ou une liste de distribution de taille relativement modeste, qui est publique (ce qui signifie que la liste de membres est disponible dans l’annuaire).In order for User C to appear, the profile owner must be in a relatively small group/DL with that user that is public (meaning the membership list is available in the directory).

Les personnes externes à l’organisation ne s’affichent pas dans la liste du propriétaire du profil.People external to the organization will not show on the profile owner's list. Les personnes avec qui il ou elle échange des messages ou qu’elles rencontrent, mais qui ne font pas partie de la même organisation, n’apparaissent pas dans la section Collaboration avec.People they email or meet with, but who are not part of the same organization, will not show up in the Working with section.