Sorting Tables After Setting Columns and Restrictions
Published: July 16, 2012
When you need to limit the view of a sorted table, always make the following IMAPITable calls in the following order:
IMAPITable::SetColumns to define the column set.
IMAPITable::Restrict to impose the restriction.
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.