Share via


Delete Method

Delete Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

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

Applies To

IMessages Interface

Type Library

Microsoft CDO for Exchange 2000 Library

DLL Implemented In

CDOEX.DLL

Syntax

[Visual Basic]Sub Delete
(
    Index As Long
)

[C++]HRESULT Delete (     long Index );

Parameters

  • Index
    The ordinal index of the Message object to delete.

Return Value

Returns S_OK if successful, or an error value otherwise.

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 because 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

[Visual Basic]

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

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.