【问题标题】:Get contacts of a group using google people api使用 google people api 获取群组的联系人
【发布时间】:2022-01-07 11:37:34
【问题描述】:

到目前为止,现有的问题和答案对我没有帮助。 我正在尝试让在线“试用此 API”为我工作。 people.connections.list 和 contactGroups.get 为我工作。 但是,我找不到获取给定组的联系人列表的方法。 看起来这应该很简单。

【问题讨论】:

    标签: google-people-api


    【解决方案1】:

    试试这个:

    1. 使用contactGroups.get 并指定一个非零 maxMembers 参数。
    2. 从返回的ContactGroup 对象中列出数组memberResourceNames[]
    {
      "resourceName": string,
      "etag": string,
      "metadata": {
        object (ContactGroupMetadata)
      },
      "groupType": enum (GroupType),
      "name": string,
      "formattedName": string,
      "memberResourceNames": [
        string
      ],
      "memberCount": integer,
      "clientData": [
        {
          object (GroupClientData)
        }
      ]
    }
    
    1. 使用检索到的资源名称使用people.getBatchGet

    我先做了一个contactGroups.list。 对于您的步骤 1。我必须从列表中设置 resourceName = contactGroups/hex 值 输出看起来不像你的

    {
      "resourceName": "contactGroups/443...",
      "etag": "k+...,
      "metadata": {
        "updateTime": "2020-11-08T15:29:59.193Z"
      },
      "groupType": "USER_CONTACT_GROUP",
      "name": "Tennis",
      "formattedName": "Tennis",
      "memberCount": 46
    }
    

    编辑:只有在 maxMembers 参数上指定 >0 时,才会出现 memberResourceNames 数组。

    【讨论】:

    • 更改 maxMembers 给了我 memberResourceNames。我想我可以从这里弄清楚。谢谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多