The IMsgStore::FinishedMsg method performs processing on a sent message. This processing can involve deleting the message, moving it to a different folder, or both actions. The type of processing depends on whether the PR_DELETE_AFTER_SUBMIT (PidTagDeleteAfterSubmit) and PR_SENTMAIL_ENTRYID (PidTagSentMailEntryId) properties are set.

In your implementation of FinishedMsg, unlock the message identified by lpEntryID and perform the appropriate processing. The target message will always be locked; the MAPI spooler never passes the entry identifier for an unlocked message to FinishedMsg.

It is possible that neither PR_DELETE_AFTER_SUBMIT or PR_SENTMAIL_ENTRYID is set, both are set, or one or the other is set. The following table describes the action you should take based on the settings:

If neither property is set:

Leave the message in the folder from which it was sent (typically the Outbox).

If both properties are set:

Move the message to the indicated folder, if desired, and then delete it.