DeleteMessage Method  
 

Remove the specified message from the current message store.

Syntax

object.DeleteMessage( [MessageIndex] )

Parameters

MessageIndex
An integer value which specifies the message that is to be removed from the message store. If this parameter is omitted, the current message as specified by the value of the StoreIndex property will be used.

Return Value

A value of zero is returned if the method succeeds. Otherwise, a non-zero error code is returned which indicates the cause of the failure.

Remarks

The DeleteMessage method marks the specified message for deletion from the storage file. When the message store is closed or purged, the message is removed from the file. Once a message has been marked for deletion, it may no longer be referenced by the application. For example, you cannot access the contents of a message that has been deleted.

The message store must be opened with write access. This method will fail if you attempt to delete a message from a storage file that has been opened for read-only access. If the application needs to delete messages in the message store, it is recommended that the file be opened for exclusive access using the mimeStoreLock option when calling the OpenStore method.

See Also

StoreCount Property, StoreIndex Property, PurgeStore Method, ReadStore Method, ReplaceMessage Method, WriteStore Method