Deleting contact photos using .NET


If you want to delete a contact photo from the Contacts API using the .NET client library, you can just call ContactsService.Delete(photoURI), like so:

ContactsService service = new ContactsService("exampleCo-exampleApp-1");
service.setUserCredentials("user@example.com", "secretPassword");
ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri("default"));

ContactsFeed feed = service.Query(query);
foreach (ContactEntry entry in feed.Entries)
{
  service.Delete(entry.PhotoEditUri);
}

Be careful, the above code will delete every contact photo in your contact list. Run this against a test account only.

3 comments:

SathishKumar said...

Hey,
After performing the delete operation,the contact Photos doesnt get deleted in my account.I am newbie.Kindly guide me.

Trevor Johns said...

@SathishKumar: Can you post this to the Contacts API help group? The people there should be able to help diagnose what the problem is.

http://groups.google.com/group/google-contacts-api

Printer Repair City said...

Amazing, learn how to resolve Canon Printer Error u052 and solve canon printer error 6a81 Also canon printer error 5200 and this is good Canon Printer Error Code 1007 find out canon printer error e04 as well as canon printer error code p22