Hi,

i'm sorry for asking it that way, but i'd like a working example to
add a contact to a group (well, it's more adding a group in a
contact), using the Python API.

Actually i'm able to create the contact (using
gdata.contacts.service.ContactsService.CreateContact) and to create
the group if it does not exists (using
gdata.contacts.service.ContactsService.CreateGroup), but i'm utterly
unable to add the contact to a group.

Short example of how i'm trying:
<code>
gd_client = convert.GoogleContactsService(email='username',
password='secret');
gd_client.ProgrammaticLogin()

group = gdata.contacts.GroupEntry(title=atom.Title(text='example'))
created_group = gd_client.CreateGroup(group)
# ok, group created, i can see it into the GMail interface

contact = gdata.contacts.ContactEntry(title=atom.Title(text='Joe
Baz'))
contact.email.append(gdata.contacts.Email(address='[email protected]',
primary='true', rel=gdata.contacts.REL_OTHER))
created_contact = gd_client.CreateContact(contact)
# ok, contact created, i can see it into the GMail interface

created_contact.group_membership_info.append
(gdata.contacts.data.GroupMembershipInfo(href=created_group.id.text))

gd_client.UpdateContact(edit_uri=created_contact.GetEditLink().href,
updated_contact=created_contact)
</code>

And the best i can get actually is a AttributeError
("'GroupMembershipInfo' object has no attribute
'_BecomeChildElement'",)
My previous attempts resulted in a no errors but no groups either...

Thank you for your time.

--

You received this message because you are subscribed to the Google Groups 
"Google Contacts API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-contacts-api?hl=en.


Reply via email to