Reputation: 11
I write this post because I have a problem using the Google API.
Google API Documentation release the code below for update a contact in .NET: (https://developers.google.com/google-apps/contacts/v3/#updating_contacts)
public static Contact UpdateContactName(ContactsRequest cr, Uri contactURL)
{
// First, retrieve the contact to update.
Contact contact = cr.Retrieve<Contact>(contactURL);
contact.Name.FullName = "New Name";
contact.Name.GivenName = "New";
contact.Name.FamilyName = "Name";
try
{
Contact updatedContact = cr.Update(contact);
Console.WriteLine("Updated: " + updatedEntry.Updated.ToString())
return updatedContact;
}
catch (GDataVersionConflictException e)
{
// Etags mismatch: handle the exception.
}
return null;
}
Well in this example we find a Google contact in directory and update the name attribute of the contact. I tested the code and it's works fine.
However if I want to add a new phone number field and not modify an existing one, how I can do that?
I tried in many ways but I'm not able to do that.
Upvotes: 1
Views: 33