【问题标题】:Google Contacts v3 API + How to add a contact to a group?Google Contacts v3 API + 如何将联系人添加到群组?
【发布时间】:2014-02-03 20:12:11
【问题描述】:

我可以对联系人或组执行 CRUD,但我不知道如何将联系人添加到特定组。

有人可以帮助我吗?

【问题讨论】:

    标签: google-contacts-api


    【解决方案1】:
     def get_group_id(label_name):
        feed = gd_client.GetGroups()
        for entry in feed.entry:
            if entry.title.text.lower() == label_name:
                return entry.id.text
    
    
    contact_entry = gdata.contacts.data.ContactEntry() #contact_entry
    group = get_group_id(label_name) #group id
    membership = gdata.contacts.data.GroupMembershipInfo(href=group) #group membership
    contact_entry.group_membership_info.append(membership) # adding group membership to contact_entry
    

    【讨论】:

      猜你喜欢
      • 2013-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多