0

I can do a CRUD with a contact or a group, but I can't figure out how to add a contact to a specific group.

Someone can help me?

Gustavo Lira
  • 391
  • 5
  • 19

1 Answers1

0
 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
Venkatesh Bachu
  • 2,348
  • 1
  • 18
  • 28