tags:

views:

297

answers:

1

I am using Google Contact API to add Contacts and Groups into Google Apps (gmail). I am able to create Contacts as well as Groups.

But now i want to:

  1. Put contact into particular group at the time of creation of Contact.
A: 
/* Get Group, this is covered in the Google Contact API documents */
/* http://code.google.com/apis/contacts/docs/2.0/developers_guide_dotnet.html#retrieving_single_group */

Group group = ...; 

Contact newContact = new Contact();

var groupMembership = new GroupMembership();
groupMembership.HRef= group.Id;


newContact.Title = "My google contact title";
newContact.GroupMembership.Add(avegaGroup);

/* Save the contact, also covered in the documents */
/* http://code.google.com/apis/contacts/docs/2.0/developers_guide_dotnet.html#Creating */
Yodiz