Copying, Moving, and Deleting

Because CDO represents tasks as Message objects, all of the methods available to messages are also available to tasks. For example, a task can be copied to another folder using the Message object’s Copy method, as shown here:

Set CdoMessage2 = CdoMessage.CopyTo(CdoFolder2.ID, CdoFolder2.StoreID)
CdoMessage2.Update

or moved to a different folder, as shown here:

Set CdoMessage2 = CdoMessage.MoveTo(CdoFolder2.ID, CdoFolder2.StoreID)

or deleted, as shown here:

CdoMessage.Delete DeletedItems:=True

For detailed discussion of these and other Message object methods, refer to Chapter 6 and Chapter 7.

Get CDO & MAPI Programming with Visual Basic: now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.