I want to retrieve a specific contact, and update its group membership. I already know the self link of the contact. To get the specific contact, the developer's guide says to do this:
The example assumes the ContactRequest
object (cr) is already set up.
Contact c = cr.Retrieve<Contact>("http://www.google.com/m8/feeds/contacts/liz%40gmail.com/full/12345");
but when I compile this, I get an error:
Argument 1: cannot convert from 'string' to 'Google.Contacts.Contact'
If I change it to:
Contact c = cr.Retrieve<Contact>(new Uri("http://www.google.com/m8/feeds/contacts/liz%40gmail.com/full/12345"));
then it compiles, and seems to retrieve okay, but I'm unable to update the contact's group membership:
c.GroupMembership.Add(member2);
cr.Update(c);
as the cr.Update(c)
line throws a GDataRequestException
(400 Bad Request) with a response string of:
"Group membership information not supported"
What am I doing wrong?
I figured out what I was doing wrong...
When retrieving the contact, I was using the "Id" property, instead of the "Self" property.
The "Id" property has "base" projection, while the "Self" property has "Full" projection.
Once I switched to using "Self" it worked properly.