Programmatically Add a New Custom Field to Google Contacts using the Google Contacts API

How to create a new "Custom field in a Google contact using the Google Contacts API (C #)?

I used:

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

Thanx

+3
source share
1 answer

See the 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/test@gmail.com/full/12345");

UPDATE your contact:

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

Source: https://habr.com/ru/post/1738470/


All Articles