HOWTO: Access, Restore, Delete Soft Deleted Item Exchange ServerID: Q232265
|
On a Microsoft Exchange server, when a message or a folder is deleted from a Public or Deleted Items Folder, a backup copy of that item is kept for a defined period of time. This period of time is known as deleted item retention time (The backup item will be referred to as a Soft Deleted Item or a Tombstone). Outlook allows you to get a list of the Soft Deleted messages in a folder and to either restore the messages back to the original folders or permanently remove the messages from the system. This article shows you how to use Extended MAPI with the SHOW_SOFT_DELETES and DELETE_HARD_DELETE flags, to programatically access, restore, and permanently delete these Soft Deleted Items.
The same Extended MAPI commands that are used with regular items (messages and folders) are used with Soft Deleted Items. In order to access these Soft Deleted Items, you must use the SHOW_SOFT_DELETES flag defined in the following. Here are a list of options that one can perform on the Soft Deleted Items.
hr = lpIPMTestFold->GetHierarchyTable(SHOW_SOFT_DELETES,&lpPubFoldTable);
hr = lpIPMTestFold->GetContentsTable(SHOW_SOFT_DELETES,&lpPubFoldContents);
hr = lpSession->OpenEntry(lpRows->aRow[0].lpProps[2].Value.bin.cb,
(LPENTRYID)lpRows->aRow[0].lpProps[2].Value.bin.lpb,
NULL,
SHOW_SOFT_DELETES | MAPI_BEST_ACCESS,
&ulObjType,
(LPUNKNOWN FAR *)&lpIPMTestMessage);
hr = lpIPMRestoreFold->CopyMessages(&sbaEIDSoftDeletedList,
NULL,
lpIPMRestoreFold,
NULL,
NULL,
NULL);
hr = lpIPMTestFold->DeleteMessages(&sbaEIDList,
NULL,
NULL,
DELETE_HARD_DELETE);
hr = lpIPMPubFold->DeleteFolder(lpspvTestFoldEID->Value.bin.cb,
(LPENTRYID)lpspvTestFoldEID->Value.bin.lpb,
NULL,
NULL,
DELETE_HARD_DELETE | DEL_FOLDERS | DEL_MESSAGES);
#define SHOW_SOFT_DELETES ((ULONG) 0x00000002)
#define DELETE_HARD_DELETE ((ULONG) 0x00000010)
Additional query words: Tombstones Soft Delete Hard DELETE_HARD_DELETE SHOW_SOFT_DELETES kbMAPI kbGrpMsg kbMsg kbDSupport
Keywords : kbMAPI kbMsg kbGrpMsg kbDSupport
Version : WINDOWS:1.0
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 13, 1999