How to: Use the Table Object to Performantly Enumerate Filtered Items in a Folder
Outlook Developer Reference |
The code sample in this topic uses the Table object to enumerate a filtered set of items in the Inbox that were last modified after May 1, 2005. For each of these items, the code sample prints these values: the subject, the time that the item was last modified, and whether the item is hidden. The procedure is as follows:
- The sample defines a filter based on the value of the LastModificationTime property of mail items.
- It applies the filter to Folder.GetTable and obtains a Table of a subset of mail items in the Inbox that satisfies the filter.
Note The returned table contains a default set of properties for each of the filtered items: EntryID, Subject, CreationTime, LastModificationTime, and MessageClass. - It then uses Columns.RemoveAll and Columns.Add to update the Table with the actually desired properties: Subject, LastModificationTime, and the hidden attribute (PR_ATTR_HIDDEN). It specifies properties with their explicit built-in names if they exist (for example, Subject, LastModificationTime), and only when they don't, it references the properties by their namespaces (for example, the hidden attribute of a mail item).
Note The Table objects returned from Folder.GetTable in Step 2 and Columns.Add in Step 3 contain different property values but for the same set of filtered items in the Inbox. - Lastly, it uses Table.GetNextRow to enumerate the filtered items (until Table.EndOfTable becomes true), displaying the values of the three desired properties for each item.
|
See Also