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("", "secretPassword");
ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri("default"));

ContactsFeed feed = service.Query(query);
foreach (ContactEntry entry in feed.Entries)

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


SathishKumar said...

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.