Answer:
If you have the email addresses you can do a people.listDirectoryPoeple request to get their name and profile pictures.
More Information:
The people.listDirectoryPeople method of tha People API can list users, returning fields specified in the readMask
parameter of the request.
A source
is mandatory, so to get domain profiles, this should be set to DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE
.
In order to obtain the names and photos of the users, you can make a request of the form:
curl \
'https://people.googleapis.com/v1/people:listDirectoryPeople?readMask=photos%2Cnames%2CemailAddresses&sources=DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
Which you can then process to find the corresponding photo and name for each email address you have.
NB: If a specific user does not have a profile picture uploaded, then their respective response object will not have the photos
field.
References: