AI-generated Key Takeaways
-
The advanced People service in Apps Script utilizes the People API to manage contact and profile data.
-
This is an advanced service that requires explicit enablement before use.
-
The service uses the same objects, methods, and parameters as the public People API.
-
Sample code is provided to demonstrate getting user connections, the user's own profile, and information for any Google Account.
The advanced People service allows you to use the People API in Apps Script. This API allows scripts to create, read, and update contact data for the logged in user and read profile data for google users.
Reference
For detailed information on this service, see the reference documentation for the People API. Like all advanced services in Apps Script, the advanced People service uses the same objects, methods, and parameters as the public API. For more information, see How method signatures are determined.
To report issues and find other support, see the People v1 support guide.
Sample code
The sample code below uses version 1 of the API.
Get the user's connections
To get a list of people in the user's contacts, use the following code:
Get the person for the user
To get the user's profile, you need to request
the https://www.googleapis.com/auth/userinfo.profile
scope by following the
instructions to add explicit scopes
to your appsscript.json
manifest file. Once the scope is added, you can use
the following code:
Get the person for a Google Account
To get the person information for any Google Account, use the following code: