Improving Outlook Performance (Part II): Video and Sample Add-In to Show Filtering Items in a Folder
In the Outlook object model, the Table object provides a light-weight row-set that allows fast enumeration and filtering of items in a folder. Each row in a Table corresponds to an item, and each column in the Table corresponds to a property of the item. You can call Folder.GetTable to obtain a Table object that represents a set of items in a folder. By default, each item in the returned Table contains only a default subset of its properties, and hence the Table object enumerates and filters faster than the Items object which contains items with all their properties. You can customize a Table to include properties other than the default properties.
As an extension to the visual how to Efficiently Getting and Setting Custom Properties in a Contact Folder in Outlook 2010, the visual how-to, Efficiently Filtering Contact Items in a Contact Folder in Outlook 2010, shows how to use the Table object to filter items in a folder based on built-in properties and custom properties. This visual how-to includes an add-in that does the following:
· When the Sales Opportunity form loads, the add-in uses the Folder.GetTable method to get the default Table object from the Opportunities folder.
· The add-in displays the data in a contact report, which is supported by a DataGridView control. The add-in shows how to manipulate the Row and Column objects corresponding to items and properties of the Table.
· The add-in supports a Filter button that selects contacts that have a specific company name value which is represented by a default, built-in property, and then displays those contacts and their default property values.
· The add-in supports a Customize Columns button that remove a couple of default properties, adds custom properties to the Table, and then displays the data.
· The add-in supports a Filter Custom Column button that selects contacts that have a specific sales representative which is represented by a custom property, and then displays those contacts and values for the customized properties in the Table.
View the video and download the add-in to try out the scenario!
See the following topics for more information about filtering items using the Table object: