Deleting a Message
A client can delete a message when it is open and the user is reading it, or when it is closed and the user is viewing the contents table. To protect a user from inadvertently removing a message, MAPI defines message deletion as a two step process:
-
Mark a message for deletion by moving it to the folder that has been designated as the Deleted Items folder — the folder whose entry identifier is stored in the PR_IPM_WASTEBASKET_ENTRYID property.
-
Remove the message by calling the IMAPIFolder::DeleteMessages method.
When a user chooses to delete a message in a folder other than the Deleted Items folder, mark it for deletion. Only when a user selects messages from within the Deleted Items folder should the messages be physically removed from the workstation. You can prompt the user to verify that the user really intended to perform the deletion.
To delete a message
-
Confirm with the user that the impending deletion is intentional.
-
Determine the parent of the folder to be deleted. If it is the Deleted Items folder or a subfolder within the Deleted Items folder, call DeleteMessages to remove the message.
-
If the folder is not contained within the Deleted Items folder, call CopyMessages with the MESSAGE_MOVE flag set to relocate the message to the Deleted Items folder.