This documentation is archived and is not being maintained.

Sorting Tables After Setting Columns and Restrictions

Last modified: January 16, 2009

Applies to: Office 2010 | Outlook 2010 | Visual Studio

When you need to limit the view of a sorted table, always make the following IMAPITable calls in the following order:

  1. IMAPITable::SetColumns to define the column set.

  2. IMAPITable::Restrict to impose the restriction.

  3. IMAPITable::SortTable to perform the sort.

If the sorted table is categorized, make a call to IMAPITable::SetCollapseState, if necessary, after the SortTable call. This ordering of calls is important because most service providers sort a table as the last task to achieve the best performance. If, for example, a message store provider must categorize a folder contents table before a restriction can be imposed, this categorization will be removed during the processing of the restriction. A second categorization will be necessary.