【问题标题】:Unable to delete shared contacts无法删除共享联系人
【发布时间】:2021-11-30 10:56:50
【问题描述】:

我可以使用 People API 中的 listDirectoryPeople 方法(使用 DirectorySourceType DIRECTORY_SOURCE_TYPE_DOMAIN_CONTACT)在 python API 中列出共享联系人。

但是,当我尝试使用 deleteContact 方法删除特定的共享联系人(resourceName)时,我收到错误消息:

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

我正在使用超级管理员验证我的脚本并使用范围:

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

为什么我无法删除共享联系人?

【问题讨论】:

    标签: google-api-client google-people-api


    【解决方案1】:

    正如范围名称 directory.readonly 所暗示的那样,它是只读的,您无法在 People API 中使用此范围修改/删除这些联系人。

    为了让 Google 工作区管理员编辑这些联系人,您需要不同的 API,请查看Shared Contacts APIhttps://developers.google.com/admin-sdk/domain-shared-contacts

    【讨论】:

    • 共享联系人 API 不再有效。当我尝试使用它时,我收到一条错误消息,提示我使用 People API。
    • 使用共享联系人 API 时:Server responded with: 400, Contacts API is being deprecated. Migrate to People API to retain programmatic access to Google Contacts. See https://developers.google.com/people/contacts-api-migration.
    • 哦,这很有趣...我在 People API 文档中没有看到任何可以直接编辑联系人的官方范围,您可能想在以下地址提交问题:issuetracker.google.com/issues/…
    • 很可能您实际上是从联系人 API 请求的。域共享联系人 API 和普通联系人 API 共享相同的 URL 格式,区别在于您是从域请求联系人还是从用户请求联系人。示例域 URL 是“google.com/m8/feeds/contacts/example.com/full”。示例用户 URL 为“google.com/m8/feeds/contacts/user@example.com/full”。域共享联系人 API 对我来说很好用。
    猜你喜欢
    • 1970-01-01
    • 2016-04-09
    • 2018-05-25
    • 1970-01-01
    • 2012-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多