The following code shows a c# method to update the info about a single google contact, for example full name.
private Contact UpdateContactName(ContactsRequest
cr, Uri contactURL)
{
Contact contact =
cr.Retrieve<Contact>(contactURL);
//FOR Example Update The Full
Name
contact.Name.FullName = "New
Full Name";
try
{
Contact
updatedContact = cr.Update(contact);
return
updatedContact;
}
catch (GDataVersionConflictException e)
{
MessageBox.Show(e.Message);
}
finally
{
//DO What You Want
}
return null;
}
Here the building of the parameters to pass to the method
GDataCredentials
Credentials = new GDataCredentials("yourEmail@gmail.com",
"yourPassword");
RequestSettings settings
= new RequestSettings("AddressBook", Credentials);
settings.UseSSL
= true;
ContactsRequest cr = new ContactsRequest(settings);
Contact contatto = cr.Retrieve<Contact>(new Uri("Your Contact Uri"));
UpdateContactName(cr, new Uri("Your Contact Uri"));
I want to remeber to go here http://support.google.com/mail/bin/answer.py?hl=it&answer=1173270 to get Application-specific password
and read here : http://dotnetoday.blogspot.it/2012/10/c-google-api-getting-google-contacts.html to have "Contact Url"
My Two Cents...
I want to remeber to go here http://support.google.com/mail/bin/answer.py?hl=it&answer=1173270 to get Application-specific password
and read here : http://dotnetoday.blogspot.it/2012/10/c-google-api-getting-google-contacts.html to have "Contact Url"
My Two Cents...
Nessun commento:
Posta un commento