Platform SDK: Exchange 2000 Server

Delete Method

[This is preliminary documentation and subject to change.]

Deletes the specified Message object in the collection and from the file system.

[Visual Basic]
Sub Delete(Index as Long)
[C++]

HRESULT Delete( long Index )

[IDL]
HRESULT Delete(long Index);
Index
The ordinal index of the Message object to delete.

Remarks

You must pass the ordinal index of the object in the collection to delete. You cannot pass an object reference.

You can use the Delete method within an enumeration successfully as the _NewEnum property returns an enumeration of the current collection in the same order as the ordinal index for each object.

The Delete method also deletes the file on the file system used to create the Message object.

Example

Dim iDropDir as New CDO.DropDirectory
Dim iMsgs as CDO.IMessages
Dim iMsg as CDO.Message
Dim i as Long
i = 1
Set iMsgs = iDropDir.GetMessages
For Each iMsg in iMsgs
  If iMsg.To = "someaddress" Then
   iMsgs.Delete i
  End If
  i = i + 1
Next iMsg