Table of contents
TOC
Réduire la table des matières
Développer la table des matières
Dernière mise à jour: 20/06/2018

Référence de l'API REST contacts Outlook (préversion)

Cette documentation traite de l'API contacts, qui est en préversion. Les fonctionnalités de la préversion sont sujettes à modifications avant leur finalisation. Elles peuvent donc entraîner des erreurs de code. C'est pourquoi il est fortement conseillé de n'utiliser que des versions de production d'une API dans votre code en production. La v2.0 est actuellement privilégiée lorsqu'elle est disponible.

L'API contacts Outlook vous permet d'obtenir des informations sur vos contacts importants. Ces informations proviennent de vos e-mails, de vos listes de contacts et de vos réseaux sociaux. Pour chaque personne vous pouvez combiner, dans une seule demande vers un seul point de terminaison, des informations provenant d'une multitude de sources. Vous pouvez utiliser l'API pour accéder à des informations sécurisées par Azure Active Directory dans Office 365. Elle offre également l'accès aux comptes Microsoft pour ces domaines : office.com, hotmail.com, live.com et office365.com.

Remarque Cet article s'applique de la même façon à l'ensemble des domaines pris en charge. Afin de simplifier les explications, le reste de l'article utilise « outlook.office.com » pour faire référence aux comptes de tous les domaines.

Ensemble des opérations de l'API contacts

L'API contacts renvoie les entités de personnes pertinentes pour chaque demande. Une personne réunit des informations provenant des e-mails, des contacts et des réseaux sociaux. Les résultats sont triés en fonction de leur pertinence, déterminée par les critères spécifiés dans la demande, et sont classés en fonction des diverses relations de communication, de collaboration et de travail.

Parcourir une liste de contacts | Obtenir une liste de contacts utilisant la recherche

Utiliser l'API REST contacts

Authentification

Comme pour toutes les autres API REST Outlook, vous devez inclure un jeton d'accès valide pour chaque demande adressée à l'API contacts. Vous devez inscrire et identifier votre application afin d'être autorisé à obtenir un jeton d'accès. Vous pouvez en savoir plus sur un certain nombre d'options simplifiées pour l'autorisation et l'inscription.

Actions et points de terminaison REST pris en charge

Pour interagir avec l'API REST contacts, vous envoyez des requêtes HTTP GET vers un point de terminaison pris en charge.

Les noms de ressources de chemin d'accès et les paramètres de requêtes ne sont pas sensibles à la casse. Mais les valeurs que vous attribuez, les ID d'entités et les autres valeurs encodées en base64 y sont, elles, sensibles.

Toutes les demandes à l'API REST contacts utilisent le format d'URL racine suivant :

https://outlook.office.com/api/{version}/{user context}

Version de l'API

{version} représente la version de l'API REST dans l'URL racine spécifiée. La seule version que vous pouvez spécifier est beta.

  • betaIl s'agit d'une préversion qui ne doit donc pas être utilisée dans du code en production. Voici un exemple d'URL : https://outlook.office.com/api/beta/me/people. Cette version inclut les dernières API en GA, ainsi que des ensembles d'API en préversion qui sont susceptibles d'être modifiées avant leur finalisation.

Utilisateur cible

{user_context} Il s'agit de l'utilisateur actuellement connecté. L'API contacts effectue en effet toutes les demandes au nom de l'utilisateur actuel. Vous pouvez spécifier le contexte utilisateur dans les demandes REST en procédant comme suit :

  • Avec le raccourci me : /api/{version}/me. L'URL racine devient https://outlook.office.com/api/{version}/me.

Dans les réponses serveur, le contexte utilisateur est identifié sous ce format : users/{AAD_userId@AAD_tenantId}.

Parcourir les contacts

Paginer une réponse | Trier une réponse | Régler le nombre de contacts dans une réponse | Sélectionner les champs renvoyés | Filtrer la réponse | Filtrer et sélectionner les champs renvoyés

Étendue nécessaire : https://outlook.office.com/people.read

La demande suivante permet d'obtenir les contacts les plus pertinents pour l'utilisateur, en fonction de ses relations de communication, de collaboration et de travail. Par défaut, chaque réponse renvoie 10 éléments. Mais vous pouvez modifier ce réglage en utilisant le paramètre $top.

https://outlook.office.com/api/beta/me/people/

La réponse à la demande est la suivante.

    {
      "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/People",
      "value": [
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAMPSuxK9KrREk1tt36xsca8=')",
          "Id": "AAUQAMPSuxK9KrREk1tt36xsca8=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Stuart Bui",
          "GivenName": "Stuart",
          "Surname": "Bui",
          "Title": "LEAD",
          "EmailAddresses": [
            {
              "Address": "sbui@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAMLasTGasi1NmGqss0adMLI=')",
          "Id": "AAUQAMLasTGasi1NmGqss0adMLI=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Phillip Wooley",
          "GivenName": "Phillip",
          "Surname": "Wooley",
          "Title": "MANAGER",
          "EmailAddresses": [
            {
              "Address": "phillipw@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQACfUjORcHM1Juw-lAPzHFIk=')",
          "Id": "AAUQACfUjORcHM1Juw-lAPzHFIk=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Nestor Kellum",
          "GivenName": "Nestor",
          "Surname": "Kellum",
          "Title": "ENGINEER",
          "EmailAddresses": [
            {
              "Address": "nestork@contoso.com"
            },
             {
              "Address": "nestork@hotmail.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQADSJ952xczZGkD0tsvxPomg=')",
          "Id": "AAUQADSJ952xczZGkD0tsvxPomg=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Lacey Burns",
          "GivenName": "Lacey",
          "Surname": "Burns",
          "Title": "MANAGER",
          "EmailAddresses": [
            {
              "Address": "laceyb@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAMJuQ5gE3IdFl1lpkykoJeY=')",
          "Id": "AAUQAMJuQ5gE3IdFl1lpkykoJeY=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Ralph Foret",
          "GivenName": "Ralph",
          "Surname": "Foret",
          "Title": "LEAD",
          "EmailAddresses": [
            {
              "Address": "ralphf@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAMrt5YwDXhJIlWoRZX9ebnw=')",
          "Id": "AAUQAMrt5YwDXhJIlWoRZX9ebnw=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Emery Hixson",
          "GivenName": "Emery",
          "Surname": "Hixson",
          "Title": "MANAGER",
          "EmailAddresses": [
            {
              "Address": "emeryh@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAOFizzhIt3ZCh4pW33s_iOQ=')",
          "Id": "AAUQAOFizzhIt3ZCh4pW33s_iOQ=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Stephanie Ray",
          "GivenName": "Stephanie",
          "Surname": "Ray",
          "Title": "MANAGER",
          "EmailAddresses": [
            {
              "Address": "stephanier@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 12"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAKirlq5lgdFHuhZ8O9FI8XA=')",
          "Id": "AAUQAKirlq5lgdFHuhZ8O9FI8XA=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Natalie Roach",
          "GivenName": "Natalie",
          "Surname": "Roach",
          "Title": "LEAD",
          "EmailAddresses": [
            {
              "Address": "natalier@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAKAXFd--O4lGr6RNJzbBXwE=')",
          "Id": "AAUQAKAXFd--O4lGr6RNJzbBXwE=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Ignacio Slayton",
          "GivenName": "Ignacio",
          "Surname": "Slayton",
          "Title": "MANAGER",
          "EmailAddresses": [
            {
              "Address": "ignacios@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 3"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAAxHEg0Rus9CmXr0FE4muco=')",
          "Id": "AAUQAAxHEg0Rus9CmXr0FE4muco=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Clayton Flanigan",
          "GivenName": "Clayton",
          "Surname": "Flanigan",
          "Title": "ENGINEER",
          "EmailAddresses": [
            {
              "Address": "claytonf@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        }
      ],
      "@odata.nextLink": "https://outlook.office.com/api/beta/me/people/?%24top=10&%24skip=10"
    }

Demander la page de contacts suivante

Si la première réponse ne contient pas la liste complète des contacts pertinents, vous pouvez effectuer une seconde demande en utilisant $top et $skip pour obtenir de nouvelles pages d'informations. Si la demande précédente contient des informations supplémentaires, la demande suivante obtient la page de contacts suivante sur le serveur.

https://outlook.office.com/api/beta/me/people/?$top=10&$skip=10

Voici la réponse du serveur.

    {
      "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/People",
      "value": [
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQADrqbKGdhxdNkjXAVQHEvMQ=')",
          "Id": "AAUQADrqbKGdhxdNkjXAVQHEvMQ=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Monte Lafferty",
          "GivenName": "Monte",
          "Surname": "Lafferty",
          "Title": "ENGINEER",
          "EmailAddresses": [
            {
              "Address": "montel@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAHiSySeJLAtAo6t0FuPmns0=')",
          "Id": "AAUQAHiSySeJLAtAo6t0FuPmns0=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Madelyn Cooley",
          "GivenName": "Madelyn",
          "Surname": "Cooley",
          "Title": "MANAGER",
          "EmailAddresses": [
            {
              "Address": "madelync@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 11"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQACQ-gdlH_4hPvR5o7cUkm7A=')",
          "Id": "AAUQACQ-gdlH_4hPvR5o7cUkm7A=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Leo Scholl",
          "GivenName": "Leo",
          "Surname": "Scholl",
          "Title": "ENGINEER",
          "EmailAddresses": [
            {
              "Address": "leos@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAHc2322QSPBJtxkeVUcXPGs=')",
          "Id": "AAUQAHc2322QSPBJtxkeVUcXPGs=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Lucinda Burke",
          "GivenName": "Lucinda",
          "Surname": "Burke",
          "Title": "ENGINEER",
          "EmailAddresses": [
            {
              "Address": "shoebm@exchange.contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAEld1zm_6W9Covp5NAGvszw=')",
          "Id": "AAUQAEld1zm_6W9Covp5NAGvszw=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Ernesto Fellows",
          "GivenName": "Ernesto",
          "Surname": "Fellows",
          "Title": "LEAD",
          "EmailAddresses": [
            {
              "Address": "ernestof@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQACgDLi02r8RDmtK-40rUPXE=')",
          "Id": "AAUQACgDLi02r8RDmtK-40rUPXE=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Margret Nash",
          "GivenName": "Margret",
          "Surname": "Nash",
          "Title": "ENGINEER",
          "EmailAddresses": [
            {
              "Address": "margretn@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAKXZsceAVjRDiUASCswoQxY=')",
          "Id": "AAUQAKXZsceAVjRDiUASCswoQxY=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Wendy Monroe",
          "GivenName": "Wendy",
          "Surname": "Monroe",
          "Title": "ARCHITECT",
          "EmailAddresses": [
            {
              "Address": "wendym@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAO-ckLra2wFBjbgc1-F5yyQ=')",
          "Id": "AAUQAO-ckLra2wFBjbgc1-F5yyQ=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Alberta Johns",
          "GivenName": "Alberta",
          "Surname": "Johns",
          "Title": "ENGINEER",
          "EmailAddresses": [
            {
              "Address": "albertaj@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAO-Giffc5HxMibij3YNPuvU=')",
          "Id": "AAUQAO-Giffc5HxMibij3YNPuvU=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Leticia Bullock",
          "GivenName": "Leticia",
          "Surname": "Bullock",
          "Title": "MANAGER",
          "EmailAddresses": [
            {
              "Address": "leticiab@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAE6BF792ae9KoMQeDZbxDK0=')",
          "Id": "AAUQAE6BF792ae9KoMQeDZbxDK0=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Angelita Dillard",
          "GivenName": "Angelita",
          "Surname": "Dillard",
          "Title": "LEAD",
          "EmailAddresses": [
            {
              "Address": "angelitad@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 3"
        }
      ],
      "@odata.nextLink": "https://outlook.office.com/api/beta/me/people/?%24skip=20&%24top=10"
    }

Trier la réponse

Par défaut, les contacts contenus dans la réponse sont triés en fonction de leur pertinence par rapport à 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, les trie par leur nom et renvoie les 10 premiers contacts sur la liste triée.

https://outlook.office.com/api/beta/me/people/?$orderby=DisplayName 

Voici la réponse du serveur.

      "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/People",
      "value": [
        {
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAO46ZoZRt65Ajfvu2d8atiw=')",
          "Id": "AAUQAO46ZoZRt65Ajfvu2d8atiw=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Angelina Blackwell",
          "GivenName": "Angelina",
          "Surname": "Blackwell",
          "Title": "MANAGER",
          "EmailAddresses": [
            {
              "Address": "angelinab@exchange.contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 5"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAGaI4BZyQURDtuk0nNvBYGk=')",
          "Id": "AAUQAGaI4BZyQURDtuk0nNvBYGk=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Benita Wilkerson",
          "GivenName": "Benita",
          "Surname": "Wilkerson",
          "Title": "RESEARCHER",
          "EmailAddresses": [
            {
              "Address": "benitaw@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building C"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAKOPqJuLWk9NtmwOx29rbew=')",
          "Id": "AAUQAKOPqJuLWk9NtmwOx29rbew=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Callie Sweet",
          "GivenName": "Callie",
          "Surname": "Sweet",
          "Title": "ENGINEER",
          "EmailAddresses": [
            {
              "Address": "callies@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 2"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxMjF2cmVxdWVzdC5zdXBwb3J0QG9lLjIxdmlhbmV0LmNvbQ==')",
          "Id": "MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxMjF2cmVxdWVzdC5zdXBwb3J0QG9lLjIxdmlhbmV0LmNvbQ==",
          "Sources": [
            {
              "Type": "Communication History"
            }
          ],
          "DisplayName": "contoso.support",
          "GivenName": null,
          "Surname": null,
          "Title": null,
          "EmailAddresses": [
            {
              "Address": "contoso.support@outlook.office.com"
            }
          ],
          "CompanyName": null,
          "OfficeLocation": null
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQACtCaoUN6WdNgpyCSeKSP6E=')",
          "Id": "AAUQACtCaoUN6WdNgpyCSeKSP6E=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Dianne Frederick",
          "GivenName": "Dianne",
          "Surname": "Frederick",
          "Title": "ENGINEER",
          "EmailAddresses": [
            {
              "Address": "diannef@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 3"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAKNvearlKU1PsHmDb-xmDrQ=')",
          "Id": "AAUQAKNvearlKU1PsHmDb-xmDrQ=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Jenifer Dotson",
          "GivenName": "Jenifer",
          "Surname": "Dotson",
          "Title": "SENENGINEER",
          "EmailAddresses": [
            {
              "Address": "jeniferd@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAAVBb0xn3ctFiZreqwDwZf0=')",
          "Id": "AAUQAAVBb0xn3ctFiZreqwDwZf0=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Nancy Washington",
          "GivenName": "Nancy",
          "Surname": "Washington",
          "Title": "MANAGER",
          "EmailAddresses": [
            {
              "Address": "nancyw@exchange.contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 3"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAKirlq5lgdFHuhZ8O9FI8XA=')",
          "Id": "AAUQAKirlq5lgdFHuhZ8O9FI8XA=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Natalie Roach",
          "GivenName": "Natalie",
          "Surname": "Roach",
          "Title": "LEAD",
          "EmailAddresses": [
            {
              "Address": "natalier@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAKVYmyKcnQ9Njw5bvInrWYI=')",
          "Id": "AAUQAKVYmyKcnQ9Njw5bvInrWYI=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Natalie Roach's Team",
          "GivenName": null,
          "Surname": null,
          "Title": null,
          "EmailAddresses": [
            {
              "Address": "ntteam@contoso.com"
            }
          ],
          "CompanyName": null,
          "OfficeLocation": null
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAFcMhzA6m4pBlHmc3Qa_PpA=')",
          "Id": "AAUQAFcMhzA6m4pBlHmc3Qa_PpA=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Queen Duncan",
          "GivenName": "Queen",
          "Surname": "Duncan",
          "Title": "MANAGER",
          "EmailAddresses": [
            {
              "Address": "queend@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 3"
        }
      ],
      "@odata.nextLink": "https://outlook.office.com/api/beta/me/people/?%24orderby=DisplayName&%24top=10&%24skip=10"
    }

Modifier le nombre de contacts renvoyés et les champs renvoyés

Vous pouvez modifier le nombre de contacts renvoyés dans la réponse en définissant le paramètre $top.

L'exemple suivant demande les 1 000 contacts les plus pertinents. La demande limite également la quantité de données renvoyées par le serveur, en ne demandant que les noms des contacts.

https://outlook.office.com/api/beta/me/people/?$top=1000&$Select=DisplayName

Voici la réponse du serveur.

    {
      "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/People(DisplayName)",
      "value": [
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAMPSuxK9KrREk1tt36xsca8=')",
          "Id": "AAUQAMPSuxK9KrREk1tt36xsca8=",
          "DisplayName": "Brian Remick"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAMLasTGasi1NmGqss0adMLI=')",
          "Id": "AAUQAMLasTGasi1NmGqss0adMLI=",
          "DisplayName": "Phillip Wooley"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQACfUjORcHM1Juw-lAPzHFIk=')",
          "Id": "AAUQACfUjORcHM1Juw-lAPzHFIk=",
          "DisplayName": "Nestor Kellum"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQADSJ952xczZGkD0tsvxPomg=')",
          "Id": "AAUQADSJ952xczZGkD0tsvxPomg=",
          "DisplayName": "Lacey Burns"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAMJuQ5gE3IdFl1lpkykoJeY=')",
          "Id": "AAUQAMJuQ5gE3IdFl1lpkykoJeY=",
          "DisplayName": "Ralph Foret"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAMrt5YwDXhJIlWoRZX9ebnw=')",
          "Id": "AAUQAMrt5YwDXhJIlWoRZX9ebnw=",
          "DisplayName": "Emery Hixson"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAOFizzhIt3ZCh4pW33s_iOQ=')",
          "Id": "AAUQAOFizzhIt3ZCh4pW33s_iOQ=",
          "DisplayName": "Stephanie Ray"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAKirlq5lgdFHuhZ8O9FI8XA=')",
          "Id": "AAUQAKirlq5lgdFHuhZ8O9FI8XA=",
          "DisplayName": "Natalie Roach"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAKAXFd--O4lGr6RNJzbBXwE=')",
          "Id": "AAUQAKAXFd--O4lGr6RNJzbBXwE=",
          "DisplayName": "Ignacio Slayton"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAAxHEg0Rus9CmXr0FE4muco=')",
          "Id": "AAUQAAxHEg0Rus9CmXr0FE4muco=",
          "DisplayName": "Clayton Flanigan"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQADrqbKGdhxdNkjXAVQHEvMQ=')",
          "Id": "AAUQADrqbKGdhxdNkjXAVQHEvMQ=",
          "DisplayName": "Monte Lafferty"
        },
        ... etc

Sélectionner les champs à renvoyer

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é.

L’exemple suivant limite la réponse au nom (DisplayName) et à l'adresse e-mail (EmailAddress) des 10 contacts les plus pertinents.

https://outlook.office.com/api/beta/me/people/?$select=DisplayName,EmailAddresses

Voici la réponse du serveur.

    {
      "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/People(DisplayName,EmailAddresses)",
      "value": [
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAMPSuxK9KrREk1tt36xsca8=')",
          "Id": "AAUQAMPSuxK9KrREk1tt36xsca8=",
          "DisplayName": "Brian Remick",
          "EmailAddresses": [
            {
              "Address": "bremick@contoso.com"
            }
          ]
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAMLasTGasi1NmGqss0adMLI=')",
          "Id": "AAUQAMLasTGasi1NmGqss0adMLI=",
          "DisplayName": "Phillip Wooley",
          "EmailAddresses": [
            {
              "Address": "phillipw@contoso.com"
            }
          ]
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQACfUjORcHM1Juw-lAPzHFIk=')",
          "Id": "AAUQACfUjORcHM1Juw-lAPzHFIk=",
          "DisplayName": "Nestor Kellum",
          "EmailAddresses": [
            {
              "Address": "nestork@contoso.com"
            },
             {
              "Address": "nestork@outlook.office.com"
            }
          ]
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQADSJ952xczZGkD0tsvxPomg=')",
          "Id": "AAUQADSJ952xczZGkD0tsvxPomg=",
          "DisplayName": "Lacey Burns",
          "EmailAddresses": [
            {
              "Address": "laceyb@contoso.com"
            }
          ]
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAMJuQ5gE3IdFl1lpkykoJeY=')",
          "Id": "AAUQAMJuQ5gE3IdFl1lpkykoJeY=",
          "DisplayName": "Ralph Foret",
          "EmailAddresses": [
            {
              "Address": "ralphf@contoso.com"
            }
          ]
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAMrt5YwDXhJIlWoRZX9ebnw=')",
          "Id": "AAUQAMrt5YwDXhJIlWoRZX9ebnw=",
          "DisplayName": "Emery Hixson",
          "EmailAddresses": [
            {
              "Address": "emeryh@contoso.com"
            }
          ]
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAOFizzhIt3ZCh4pW33s_iOQ=')",
          "Id": "AAUQAOFizzhIt3ZCh4pW33s_iOQ=",
          "DisplayName": "Stephanie Ray",
          "EmailAddresses": [
            {
              "Address": "stephanier@contoso.com"
            }
          ]
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAKirlq5lgdFHuhZ8O9FI8XA=')",
          "Id": "AAUQAKirlq5lgdFHuhZ8O9FI8XA=",
          "DisplayName": "Natalie Roach",
          "EmailAddresses": [
            {
              "Address": "natalier@contoso.com"
            }
          ]
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAKAXFd--O4lGr6RNJzbBXwE=')",
          "Id": "AAUQAKAXFd--O4lGr6RNJzbBXwE=",
          "DisplayName": "Ignacio Slayton",
          "EmailAddresses": [
            {
              "Address": "ignacios@contoso.com"
            }
          ]
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAAxHEg0Rus9CmXr0FE4muco=')",
          "Id": "AAUQAAxHEg0Rus9CmXr0FE4muco=",
          "DisplayName": "Clayton Flanigan",
          "EmailAddresses": [
            {
              "Address": "claytonf@contoso.com"
            }
          ]
        }
      ],
      "@odata.nextLink": "https://outlook.office.com/api/beta/me/people/?%24select=DisplayName%2cEmailAddresses&%24top=10&%24skip=10"
    }

Utiliser un filtre pour limiter la réponse

Vous pouvez utiliser le paramètre $filter pour limiter la réponse aux seuls contacts contenant les critères spécifiés.

La requête suivante limite la réponse aux contacts disposant de la source « historique des communications ».

https://outlook.office.com/api/beta/me/people/?$Filter=Sources/Any (source: source/Type  eq 'Communications History') 
    {
      "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/People",
      "value": [
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxcGVvcGxlcmVsZXZhbmNlQHNlcnZpY2UuZXhjaGFuZ2UubWljcm9zb2Z0LmNvbQ==')",
          "Id": "MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxcGVvcGxlcmVsZXZhbmNlQHNlcnZpY2UuZXhjaGFuZ2UubWljcm9zb2Z0LmNvbQ==",
          "Sources": [
            {
              "Type": "Communication History"
            }
          ],
          "DisplayName": "People Relevance",
          "GivenName": null,
          "Surname": null,
          "Title": null,
          "EmailAddresses": [
            {
              "Address": "peoplerelevance@service.exchange.contoso.com"
            }
          ],
          "CompanyName": null,
          "OfficeLocation": null
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxcmNoaUByY2hpbGF3LmNvbQ==')",
          "Id": "MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxcmNoaUByY2hpbGF3LmNvbQ==",
          "Sources": [
            {
              "Type": "Communication History"
            }
          ],
          "DisplayName": "Edna Dickson",
          "GivenName": null,
          "Surname": null,
          "Title": null,
          "EmailAddresses": [
            {
              "Address": "ednad@outlook.office.com"
            }
          ],
          "CompanyName": null,
          "OfficeLocation": null
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxMjF2cmVxdWVzdC5zdXBwb3J0QG9lLjIxdmlhbmV0LmNvbQ==')",
          "Id": "MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxMjF2cmVxdWVzdC5zdXBwb3J0QG9lLjIxdmlhbmV0LmNvbQ==",
          "Sources": [
            {
              "Type": "Communication History"
            }
          ],
          "DisplayName": "contoso.support",
          "GivenName": null,
          "Surname": null,
          "Title": null,
          "EmailAddresses": [
            {
              "Address": "contoso.support@contoso.com"
            }
          ],
          "CompanyName": null,
          "OfficeLocation": null
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxUGVvcGxlOTExMUBzZXJ2aWNlLmV4Y2hhbmdlLm1pY3Jvc29mdC5jb20=')",
          "Id": "MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxUGVvcGxlOTExMUBzZXJ2aWNlLmV4Y2hhbmdlLm1pY3Jvc29mdC5jb20=",
          "Sources": [
            {
              "Type": "Communication History"
            }
          ],
          "DisplayName": "gethelp@contoso.com",
          "GivenName": null,
          "Surname": null,
          "Title": null,
          "EmailAddresses": [
            {
              "Address": "gethelp@contoso.com"
            }
          ],
          "CompanyName": null,
          "OfficeLocation": null
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxc21hcnRhbGVydHNAbWljcm9zb2Z0LmNvbQ==')",
          "Id": "MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxc21hcnRhbGVydHNAbWljcm9zb2Z0LmNvbQ==",
          "Sources": [
            {
              "Type": "Communication History"
            }
          ],
          "DisplayName": "smartalerts@contoso.com",
          "GivenName": null,
          "Surname": null,
          "Title": null,
          "EmailAddresses": [
            {
              "Address": "smartalerts@contoso.com"
            }
          ],
          "CompanyName": null,
          "OfficeLocation": null
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxam9lQG9saXZlYW5kZ29vc2UuY29t')",
          "Id": "MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxam9lQG9saXZlYW5kZ29vc2UuY29t",
          "Sources": [
            {
              "Type": "Communication History"
            }
          ],
          "DisplayName": "Emily Burnett",
          "GivenName": null,
          "Surname": null,
          "Title": null,
          "EmailAddresses": [
            {
              "Address": "emilyb@contoso.com"
            }
          ],
          "CompanyName": null,
          "OfficeLocation": null
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxYS1jYW1hbm5AbWljcm9zb2Z0LmNvbQ==')",
          "Id": "MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxYS1jYW1hbm5AbWljcm9zb2Z0LmNvbQ==",
          "Sources": [
            {
              "Type": "Communication History"
            }
          ],
          "DisplayName": "Bridgett Baxter",
          "GivenName": null,
          "Surname": null,
          "Title": null,
          "EmailAddresses": [
            {
              "Address": "bridgettb@contoso.com"
            }
          ],
          "CompanyName": null,
          "OfficeLocation": null
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxc3RlZmFuLmJ1cmFrQGluc2lkZXZpZXcuY29t')",
          "Id": "MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxc3RlZmFuLmJ1cmFrQGluc2lkZXZpZXcuY29t",
          "Sources": [
            {
              "Type": "Communication History"
            }
          ],
          "DisplayName": "Charlotte Stark",
          "GivenName": null,
          "Surname": null,
          "Title": null,
          "EmailAddresses": [
            {
              "Address": "charlottes@insideview.com"
            }
          ],
          "CompanyName": null,
          "OfficeLocation": null
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxbWFyaWFuYXN0ZXBwQG91dGxvb2suY29t')",
          "Id": "MkU4MDBGNDUtMEY3OS00MzM4LTg3RUUtNENFOTFBRURCODcxbWFyaWFuYXN0ZXBwQG91dGxvb2suY29t",
          "Sources": [
            {
              "Type": "Communication History"
            }
          ],
          "DisplayName": "herminiah@outlook.office.com",
          "GivenName": null,
          "Surname": null,
          "Title": null,
          "EmailAddresses": [
            {
              "Address": "herminiah@outlook.office.com"
            }
          ],
          "CompanyName": null,
          "OfficeLocation": null
        }
      ],
      "@odata.nextLink": "https://outlook.office.com/api/beta/me/people/?%24Filter=Sources%2fAny+(source%3a+source%2fType++eq+%27Communication+History%27)&%24top=10&%24skip=10"
    }

Sélectionner les champs à renvoyer dans une réponse filtrée

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.

L'exemple suivant permet ainsi d'obtenir le nom (DisplayName) et l'adresse e-mail (EmailAddress) des contacts dont le nom est identique à celui mentionné. Dans cet exemple, seuls les contacts dont le nom est « Nestor Kellum » sont renvoyés.

https://outlook.office.com/api/beta/me/people/?$select=DisplayName,EmailAddresses&$Filter=DisplayName eq 'Nestor Kellum' 

Voici la réponse du serveur.

    {
      "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/People(DisplayName,EmailAddresses)",
      "value": [
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQACfUjORcHM1Juw-lAPzHFIk=')",
          "Id": "AAUQACfUjORcHM1Juw-lAPzHFIk=",
          "DisplayName": "Nestor Kellum",
          "EmailAddresses": [
            {
              "Address": "nestork@contoso.com"
            },
             {
              "Address": "nestork@outlook.office.com"
            }
          ]
        }
      ]
    }

Rechercher des contacts

Rechercher un sujet |

Effectuer une recherche approximative

Étendue nécessaire : https://outlook.office.com/people.read

Utiliser la recherche pour sélectionner des contacts

Utilisez le paramètre $search pour sélectionner les contacts répondant à un ensemble de critères.

La requête de recherche suivante renvoie les contacts pertinents dont le prénom (GivenName) ou le nom (Surname) commencent par la lettre « j ».

https://outlook.office.com/api/beta/me/people/?$search=j

Voici la réponse du serveur.

        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAC4PuXFfR6pAin18WlyOqxI=')",
          "Id": "AAUQAC4PuXFfR6pAin18WlyOqxI=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Jacquelyn Cox",
          "GivenName": "Jacquelyn",
          "Surname": "Cox",
          "Title": "ENGINEER",
          "EmailAddresses": [
            {
              "Address": "jacquelync@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building S"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAFE5-QvXOi1KhbNrQQaV-dk=')",
          "Id": "AAUQAFE5-QvXOi1KhbNrQQaV-dk=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Julie Yates",
          "GivenName": "Julie",
          "Surname": "Yates",
          "Title": "MANAGER",
          "EmailAddresses": [
            {
              "Address": "juliey@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 2"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAChuH75CMB5NsGP0QBDcX2g=')",
          "Id": "AAUQAChuH75CMB5NsGP0QBDcX2g=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Juliette Mitchell",
          "GivenName": "Juliette",
          "Surname": "Mitchell",
          "Title": "MANAGER",
          "EmailAddresses": [
            {
              "Address": "juliettem@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building 4"
        },
        {
          "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAMsDacKpHNpFj7ViBXFiRZI=')",
          "Id": "AAUQAMsDacKpHNpFj7ViBXFiRZI=",
          "Sources": [
            {
              "Type": "Directory"
            }
          ],
          "DisplayName": "Katheryn Johns",
          "GivenName": "Katheryn",
          "Surname": "Johns",
          "Title": "ENGINEER",
          "EmailAddresses": [
            {
              "Address": "katherynj@contoso.com"
            }
          ],
          "CompanyName": "CONTOSO",
          "OfficeLocation": "Building T"
        }
      ],
      "@odata.nextLink": "https://outlook.office.com/api/beta/me/people/?%24search=d&%24top=10&%24skip=10"
    }

Utiliser la recherche pour spécifier un sujet pertinent

La demande suivante renvoie les contacts pertinents dont le nom contient « ma » et qui ont manifesté leur intérêt pour l'humoriste « Aziz Ansari ».

 https://outlook.office.com/api/beta/me/people/?$search="ma topic: Aziz Ansari" 

Voici la réponse du serveur.

   {
     "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/People",
     "value": [
       {
         "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQACgDLi02r8RDmtK-40rUPXE=')",
         "Id": "AAUQACgDLi02r8RDmtK-40rUPXE=",
         "Sources": [
           {
             "Type": "Directory"
           }
         ],
         "DisplayName": "Margret Nash",
         "GivenName": "Margret",
         "Surname": "Nash",
         "Title": "ENGINEER",
         "EmailAddresses": [
           {
             "Address": "margretn@contoso.com"
           }
         ],
         "CompanyName": "CONTOSO",
         "OfficeLocation": "Building 4"
       },
       {
         "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAHiSySeJLAtAo6t0FuPmns0=')",
         "Id": "AAUQAHiSySeJLAtAo6t0FuPmns0=",
         "Sources": [
           {
             "Type": "Directory"
           }
         ],
         "DisplayName": "Madelyn Cooley",
         "GivenName": "Madelyn",
         "Surname": "Cooley",
         "Title": "MANAGER",
         "EmailAddresses": [
           {
             "Address": "madelync@contoso.com"
           }
         ],
         "CompanyName": "CONTOSO",
         "OfficeLocation": "Building 11"
       },
       {
         "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAAebvnx4LnNKsFWppdcopJw=')",
         "Id": "AAUQAAebvnx4LnNKsFWppdcopJw=",
         "Sources": [
           {
             "Type": "Directory"
           }
         ],
         "DisplayName": "Albert Raley",
         "GivenName": "Albert",
         "Surname": "Raley",
         "Title": "MANAGER",
         "EmailAddresses": [
           {
             "Address": "albertr@contoso.com"
           }
         ],
         "CompanyName": "CONTOSO",
         "OfficeLocation": "Bulding T"
       },
       {
         "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAPqWcitEhEFNuvaSLteeN9M=')",
         "Id": "AAUQAPqWcitEhEFNuvaSLteeN9M=",
         "Sources": [
           {
             "Type": "Directory"
           }
         ],
         "DisplayName": "Emanuel Grider",
         "GivenName": "Emanuel",
         "Surname": "Grider",
         "Title": "MANAGER",
         "EmailAddresses": [
           {
             "Address": "edh@contoso.com"
           }
         ],
         "CompanyName": "CONTOSO",
         "OfficeLocation": "Building 4"
       },
       {
         "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAIqrTSzA3N1BglLTWFzgql4=')",
         "Id": "AAUQAIqrTSzA3N1BglLTWFzgql4=",
         "Sources": [
           {
             "Type": "Directory"
           }
         ],
         "DisplayName": "Frederick Magnuson",
         "GivenName": "Frederick",
         "Surname": "Magnuson",
         "Title": "LEAD",
         "EmailAddresses": [
           {
             "Address": "fredrickm@service.exchange.contoso.com"
           }
         ],
         "CompanyName": "CONTOSO",
         "OfficeLocation": "Building 3"
       },
       {
         "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAId9cw-r_cZDtd5mU6QVvR4=')",
         "Id": "AAUQAId9cw-r_cZDtd5mU6QVvR4=",
         "Sources": [
           {
             "Type": "Directory"
           }
         ],
         "DisplayName": "Beryl Maddox",
         "GivenName": "Beryl",
         "Surname": "Maddox",
         "Title": "MANAGER",
         "EmailAddresses": [
           {
             "Address": "berylm@contoso.com"
           }
         ],
         "CompanyName": "CONTOSO",
         "OfficeLocation": "Building 3"
       },
       {
         "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAPbEMn4Y_EhPoPJIAfe9-v4=')",
         "Id": "AAUQAPbEMn4Y_EhPoPJIAfe9-v4=",
         "Sources": [
           {
             "Type": "Directory"
           }
         ],
         "DisplayName": "Vilma Young",
         "GivenName": "Vilma",
         "Surname": "Young",
         "Title": "LEAD",
         "EmailAddresses": [
           {
             "Address": "vilmay@contoso.com"
           }
         ],
         "CompanyName": "CONTOSO",
         "OfficeLocation": "Building T"
       },
       {
         "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQANxLXO4NLchEiyteaLb_HNM=')",
         "Id": "AAUQANxLXO4NLchEiyteaLb_HNM=",
         "Sources": [
           {
             "Type": "Directory"
           }
         ],
         "DisplayName": "Edna Foreman",
         "GivenName": "Edna",
         "Surname": "Foreman",
         "Title": null,
         "EmailAddresses": [
           {
             "Address": "ednaf@contoso.com"
           }
         ],
         "CompanyName": "CONTOSO",
         "OfficeLocation": "Building L"
       },
       {
         "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAQkADA5OWM3MmE5LTNmYmItNDk1NS1hZDY0LTAwYjBhZjc4MTg3YwAQABMxxzYk20pLinJq19EtuKc=')",
         "Id": "AAQkADA5OWM3MmE5LTNmYmItNDk1NS1hZDY0LTAwYjBhZjc4MTg3YwAQABMxxzYk20pLinJq19EtuKc=",
         "Sources": [
           {
             "Type": "Outlook Contacts"
           }
         ],
         "DisplayName": "Tammi Pickett",
         "GivenName": "Tammi",
         "Surname": "Pickett",
         "Title": "Engineer",
         "EmailAddresses": [
           {
             "Address": "tammip@contoso.com"
           }
         ],
         "CompanyName": "Contoso",
         "OfficeLocation": null
       },
     "@odata.nextLink": "https://outlook.office.com/api/beta/me/people/?%24search=%22ed+topic%3a+Aziz+ansari%22&
%24top=10&%24skip=10"
   }

Effectuer une recherche approximative

La demande suivante effectue une recherche concernant un contact nommé « Hermaini Hall ». Comme il existe un contact pertinent dont le nom est « Herminia Hull », les informations concernant « Herminia Hull » sont renvoyées.

https://outlook.office.com/api/beta/me/people/?$search="hermaini hall"

Voici la réponse du serveur.

   {
     "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/People",
     "value": [
       {
         "@odata.id": "https://outlook.office.com/api/beta/users/4579DA25-3624-44CD-AE44-9777EEB9D292@F56380F1-06A5-4239-B31E-C8B44DF1F05A/People('AAUQAL5wQK1L1MNNsL4qzoFWZiQ=')",
         "Id": "AAUQAL5wQK1L1MNNsL4qzoFWZiQ=",
         "Sources": [
           {
             "Type": "Directory"
           }
         ],
         "DisplayName": "Herminia Hull",
         "GivenName": "Herminia",
         "Surname": "Hull",
         "Title": "MANAGER",
         "EmailAddresses": [
           {
             "Address": "herminiah@contoso.com"
           }
         ],
         "CompanyName": "CONTOSO",
         "OfficeLocation": "Building 4"
       }
     ]
   }

© 2018 Microsoft