Preeti
Preeti

Reputation: 1386

Programatically adding "New Custom Field" To Google Contacts using Google contact API

How to create new "Custom Field into Google Contact using Google Contact API (c#)?

I used:

ExtendedProperty obj_ExtendedProperty = new ExtendedProperty(); 
 obj_ExtendedProperty.Name             = "Department";
 obj_ExtendedProperty.Value            = "Sales";
 ContactEntry.ExtendedProperties.Add(obj_ExtendedProperty);

Thanx

Upvotes: 3

Views: 2100

Answers (1)

systempuntoout
systempuntoout

Reputation: 74094

Have a look to ContactEntry class and how to update it.

RETRIEVE your contact:

RequestSettings rs = new RequestSettings(this.ApplicationName, this.userName,this.passWord);      
ContactsRequest cr = new ContactsRequest(rs);  
Contact contact = cr.Retrieve<Contact>("http://www.google.com/m8/feeds/contacts/[email protected]/full/12345");

UPDATE your contact:

UserDefinedField customField= new UserDefinedField("yourFieldName","yourFieldValue);  
contact.addUserDefinedField(customField);  
Contact updatedContact = cr.Update(contact);

Upvotes: 2

Related Questions