Unable to delete shared contacts

Viewed 95

I am able to list the shared contacts in the python API using the listDirectoryPeople method (with the DirectorySourceType DIRECTORY_SOURCE_TYPE_DOMAIN_CONTACT) in the People API.

However, when I try to delete a specific shared contact (by resourceName) using the deleteContact method, I get the error:

"Resource name "people/<resource_string>" is not a valid contact person resource."

I am authenticating my script with a SuperAdmin and using the scopes:

SCOPES = [
    'https://www.googleapis.com/auth/contacts',
    'https://www.googleapis.com/auth/directory.readonly'
]

Why am I unable to delete shared contacts?

1 Answers

As the scope name directory.readonly suggests, it is read-only, and you can't modify/delete these contacts using this scope in the People API.

In order for Google workspace admins to edit these contacts you need a different API, check out the Shared Contacts API: https://developers.google.com/admin-sdk/domain-shared-contacts

Related