Applies to: Outlook 2013 | Outlook 2016

Retrieves the current sort order for a table.

HRESULT QuerySortOrder(
LPSSortOrderSet FAR * lppSortCriteria



[out] Pointer to a pointer to the SSortOrderSet structure holding the current sort order.

Return value


The current sort order was successfully returned.


Another operation is in progress that prevents the sort order retrieval operation from starting. Either the operation in progress should be allowed to complete or it should be stopped.


The IMAPITable::QuerySortOrder method retrieves the current sort order for a table. Sort orders are described with an SSortOrderSet structure.

  • The cSorts member of the SSortOrderSet structure can be set to zero if:

  • The table is unsorted.

  • There is no information about how the table is sorted.

  • The SSortOrderSet structure is not appropriate for describing the sort order.

Notes to implementers

If a call is made to your IMAPITable::SortTable method with an SSortOrderSet structure containing zero columns in the sort key, remove the current sort order and apply the default order, if there is one. In subsequent calls to QuerySortOrder, you can choose whether to return zero or more columns for the sort key. You can return more columns than are in the present view.

For more information about sorting, see Sorting and Categorization.

See also




IMAPITable : IUnknown