Platform SDK: MAPI |
The IMAPIFolder::DeleteMessages method deletes one or more messages.
See IMAPIFolder : IMAPIContainer.
HRESULT DeleteMessages( LPENTRYLIST lpMsgList, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags );
The IMAPIFolder::DeleteMessages method deletes messages from a folder. Messages that do not exist, that have been moved elsewhere, that are open with read/write access, or that are currently submitted cannot be deleted.
When the delete operation involves more than one message, perform the operation as completely as possible for each folder, even if one or more of the messages cannot be deleted. Do not stop the operation prematurely unless a failure occurs that is beyond your control, such as running out of memory, running out of disk space, or corruption in the message store.
During a DeleteMessages call, messages being processed by the MAPI spooler are not deleted; they are left in their parent folders. Do not call the IMsgStore::AbortSubmit method for these messages.
Expect these return values under the following conditions:
Condition | Return value |
---|---|
DeleteMessages has successfully deleted every message. | S_OK |
DeleteMessages was unable to successfully delete every message and subfolder. | MAPI_W_PARTIAL_COMPLETION or MAPI_E_NOT_FOUND |
DeleteMessages was unable to complete. | Any error value except MAPI_E_NOT_FOUND |
When DeleteMessages is unable to complete, do not assume that no work was done. DeleteMessages might have been able to delete one or more of the messages before encountering the error.
DeleteMessages returns MAPI_W_PARTIAL_COMPLETION or MAPI_E_NOT_FOUND, depending on the message store's implementation.