O'Reilly logo

CDO & MAPI Programming with Visual Basic: by Dave Grundgeiger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Message Filters with Task Folders

Recall from Chapter 7 that Messages collections can be filtered using the MessageFilter object. The same technique can be applied to limit the set of tasks returned in a task folder’s Messages collection. Although the MessageFilter object can’t filter on task item-specific properties, such as due date, some of the properties that can be filtered are nevertheless useful when working with tasks. The properties of the MessageFilter object that can be applied to tasks are:

Conversation

Setting the Conversation property causes the associated Messages collection to contain only Message objects having their ConversationTopic properties equal to this value. The datatype is String.

Fields

By adding Field objects to the MessageFilter object’s Fields collection, it is possible to filter on properties that are not directly accessible through the MessageFilter object. For example, this code restricts a Messages collection to items having attachments:

' CdoMessages already Dim'ed and Set.
Dim CdoMessageFilter As MAPI.MessageFilter
Dim CdoFields As MAPI.Fields

Set CdoMessageFilter = CdoMessages.Filter
Set CdoFields = CdoMessageFilter.Fields
CdoFields.Add CdoPR_HASATTACH, True

' At this point, CdoMessages only returns items that have attachments.
Importance

Setting the Importance property causes the associated Messages collection to contain only Message objects having their Importance properties equal to this value. It is a Long that can be set to CdoLow ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required