According to the docs, when I remove a contact from an address book, it is moved to a “removed”-folder. Suppose there’s a lazy programmer (not you nor me, of course) who doesn’t want to write the code to update the contacts on each start of Outlook but simply removes all the contacts from an address book and then repopulates it (let’s say there are not that many users to populate with and that Outlook is started a large number of times each day), so that the performance isn’t an issue but the increasingly huge amount of entries in the deleted folder is.
Does Outlook manage the storage of deletes neatly or do I need, hrmp…, does that lazy programmer need to worry about it?
The said programmer would probably be using code that looks something like exactly this.
Outlook.Folder contacts =
this.Application.Session.GetDefaultFolder(
Outlook.OlDefaultFolders.olFolderContacts) as Outlook.Folder;
Outlook.Folder addressBook = contacts.Folders["lazy"] as Outlook.Folder;
while (addressBook.Items.Count > 0)
addressBook.Items.OfType<Outlook.ContactItem>().Last().Delete();
If he needs to worry, He’d probably want to delete the deletes from the deletion folder but, of course, only those that were deleted by his software. Is there a smooth way to delete-delete a contact?
I would just re-create the
Folderevery time and avoid the slow one-by-oneContactItemdeletions. When you remove theFolderit will not keep a copy in the deleted items. OneFolderdelete & save will be faster than a large number of item deletions.Just follow the address book creation steps from the previous SO post.