Global Address List Graph API

2019-07-14 19:07发布

问题:

I am trying to use the Graph API inside an Office 365 add-in to get contact information out of GAL. Neither of the following queries return any contacts from the GAL, although both return some information.

beta/me/contacts?$filter=displayName eq 'John Smith'

beta/me/people?$filter=displayName eq 'John Smith'

Is it possible to get contacts from the GAL using the Graph API? I having a feeling I am not giving my app the correct permission to access the GAL.

回答1:

The /me/contacts endpoint returns the contacts from your default Outlook Contacts folder. The /me/people endpoint is similar but attempts to pull information on contacts access multiple sources.

The GAL represents contact information from your organization (i.e. Active Directory). To see the contact information for other users in your organization, you use the /users endpoint. To see organizational contacts (contacts added to the AD/GAL) you need to use the /contacts endpoint (note the lack of /me/ in the path).