how to Add contact to a group using python api

716 views
Skip to first unread message

Antonio Carranza López

unread,
May 6, 2011, 6:57:00 AM5/6/11
to google-co...@googlegroups.com

I'm updating a contact using this python code:

contact_client = gdata.contacts.client.ContactsClient(source=APPL)
contact_client.ClientLogin(USER, PASS, APPL)
new_group = gdata.contacts.data.GroupEntry(title=atom.data.Title(text='Clientes'))
cli_group_entry = contact_client.CreateGroup(new_group) 
entry.group_membership_info.append(cli_group_entry)
upd_entry = contact_client.Update(entry)
After doing that my entry looks like contactolog.xml (left side of picture) has the group info but not in the right way like the contact in the right side of the picture wich have the ns2:groupMemberShipInfo. 


I supose that I'm not using the right method but cant find the right one in any doc.

Thanks,

Antonio Carranza López

unread,
May 8, 2011, 3:39:45 AM5/8/11
to Google Contacts, Shared Contacts and User Profiles APIs
I found the way, I was appending the group entry to the feed and only
needed to append the id.
so I'm posting it.

groupinfo = gdata.contacts.data.GroupMembershipInfo(href='',
deleted=False)
groupinfo.href = group_entry.id.text

entry.group_membership_info.append(groupinfo)

On 6 mayo, 12:57, Antonio Carranza López <antonio.carra...@gmail.com>
wrote:
> I'm updating a contact using this python code:
>
> contact_client = gdata.contacts.client.ContactsClient(source=APPL)
> contact_client.ClientLogin(USER, PASS, APPL)
> new_group =
> gdata.contacts.data.GroupEntry(title=atom.data.Title(text='Clientes'))
> cli_group_entry = contact_client.CreateGroup(new_group)
> *entry.group_membership_info.append(cli_group_entry)*
> upd_entry = contact_client.Update(entry)
>
> After doing that my entry looks like contactolog.xml (left side of picture)
> has the group info but not in the right way like the contact in the right
> side of the picture wich have the ns2:groupMemberShipInfo.
>
> <https://lh4.googleusercontent.com/_d-V68U3uo-8/TcPR6wo9AQI/AAAAAAAAAQ...>

Nicolas Garnier

unread,
Jul 7, 2011, 5:40:51 AM7/7/11
to google-co...@googlegroups.com
Thanks for sharing Antonio!

Nicolas Garnier

Developer Programs Engineer
Google Developer Relations
Google Switzerland GmbH.  
Brandschenkestrasse 110, 
8002 Zurich, 
Switzerland


The above terms reflect a potential business arrangement, are provided solely as a basis for further discussion, and are not intended to be and do not constitute a legally binding obligation. No legally binding obligations will be created, implied, or inferred until an agreement in final form is executed in writing by all parties involved.

This email may be confidential or privileged. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it went to the wrong person. Thanks
 
--

“When I’m being sad, I stop being sad and be awesome instead”



--
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
google-co...@googlegroups.com
To unsubscribe from this group, send email to
google-contacts...@googlegroups.com
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html

Reply all
Reply to author
Forward
0 new messages