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:
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.
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.
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