Programatically adding “New Custom Field” To Google Contacts using Google contact API

别说谁变了你拦得住时间么 提交于 2019-12-06 06:27:40

问题


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


回答1:


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

UPDATE your contact:

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


来源:https://stackoverflow.com/questions/2515117/programatically-adding-new-custom-field-to-google-contacts-using-google-contac

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!