Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
4/8/2010

The SortTablemethod orders the rows of the table based on sort criteria.

Note:
This method is supported for contents tables only.

Syntax

HRESULT SortTable (
  LPSSortOrderSet 
lpSortCriteria,
  ULONG 
ulFlags
);

Parameters

lpSortCriteria

[in] Reference to an SSortOrderSetstructure containing the sort criteria to apply; cannot be NULL. See Remarksfor information about the restrictions on the members of this parameter.

ulFlags

[in] Not used; must be zero.

Return Value

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

S_OK

Indicates success.

MAPI_E_BUSY

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

MAPI_E_NO_SUPPORT

The table does not support the type of sorting requested.

Remarks

The SSortOrderSetstructure that is referenced by the lpSortCriteriaparameter has the following restrictions:

  • The cSortsmember must be either 0 (no sort performed) or 1 (sort on the criterion specified by the aSort[0]member).

  • The cCategoriesmember must be 0.

  • The cExpandedmember must be 0.

  • The aSort[0].ulOrdermember cannot be TABLE_SORT_COMBINE.

  • The aSort[0].ulPropTagmember must be one of the following:

    • PR_MESSAGE_DELIVERY_TIME(Sort by time received.)

    • PR_SENDER_NAME_W(Sort by sender.)

    • PR_SUBJECT_W(Sort by subject.)

    • PR_CONTENT_LENGTH(Sort by size.)

When there are zero columns in the SSortOrderSetstructure pointed to by the lpSortCriteriaparameter, the table returns the current column set.

All bookmarks for a table are invalidated and should be deleted when a call to SortTableis made, and the BOOKMARK_CURRENTbookmark, indicating the current cursor position, should be set to the beginning of the table.

For best performance, call IMAPITable::SetColumnsto customize the table's column set and IMAPITable::Restrictto limit the number of rows in the table before calling SortTableto perform the sort.

Whenever SortTablefails, the sort order that was in effect before the failure remains in effect.

Requirements

Header mapidefs.h
Library cemapi.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Pocket PC 2002 and later, Smartphone 2002 and later

See Also