I am superadmin of a Google Workspace. I want to retrieve Google Contacts from several accounts of my workspace (accounts like press@....org
, donate@....org
).
For doing that via the API call googleapiclient.discovery.build('people', 'v1', credentials=creds).people().connections().list(resourceName=resourceName)
I need resourceName
s for the accounts of interest.
I tried doing that by running in Python googleapiclient.discovery.build('people', 'v1', credentials=creds).people().listDirectoryPeople(readMask= 'emailAddresses', sources= ['DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE'], pageSize= 1000).execute())
. During token retrieval I'm using SCOPES = ['https://www.googleapis.com/auth/contacts.readonly', 'https://www.googleapis.com/auth/directory.readonly']
and re-obtained the creds.
After doing that I received an error:
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://people.googleapis.com/v1/people:listDirectoryPeople?readMask=emailAddresses&sources=DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE&pageSize=1000&alt=json returned "The G Suite domain admin has disabled external directory sharing. See more details at https://support.google.com/a/answer/6343701". Details: "The G Suite domain admin has disabled external directory sharing. See more details at https://support.google.com/a/answer/6343701">
I went to https://support.google.com/a/answer/6343701 and as recommended switched to Public data and authenticated user basic profile fields
in Directory settings. I waited 24 hours, but I'm still getting the same error.
What is the proper way to get resourceName
s for the accounts I'm interested in?
In general, am I using the right API calls?
My endgoal is to collect Google Contacts for these accounts. I am superadmin, so I can set up any permissions needed, if I know what is needed :)
Thank you very much!