Partager via


IMAPITable::SortTable (Compact 7)

3/12/2014

This method 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] Pointer to a reference to an SSortOrderSet structure that contains the sort criteria to apply; cannot be NULL. See Remarks for information about restrictions on the members of this parameter.
  • ulFlags
    [in] Not used; must be zero.

Return Value

The following table shows the possible return values.

Value Description

S_OK

The method succeeded.

MAPI_E_BUSY

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

MAPI_E_NO_SUPPORT

The table does not support the type of sorting requested.

E_FAIL

The operation failed due to an unspecified error.

E_INVALIDARG

The operation failed because one or more of the arguments is not valid.

E_OUTOFMEMORY

The operation failed because it needs more memory resources.

E_UNEXPECTED

The operation failed due to an unexpected error.

Remarks

The SSortOrderSet structure that is referenced by the lpSortCriteria parameter has the following restrictions:

  • The cSorts member must be either 0 (no sort performed) or 1 (sort on the criterion specified by the aSort[0] member).
  • The cCategories member must be 0.
  • The cExpanded member must be 0.
  • The aSort[0].ulOrder member cannot be TABLE_SORT_COMBINE.
  • The aSort[0].ulPropTag member 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 SSortOrderSet structure that the lpSortCriteria parameter points to, the table returns the current column set.

All bookmarks for a table are invalidated and must be deleted when a call to SortTable is made, and the BOOKMARK_CURRENT bookmark, which indicates the current cursor position, must be set to the beginning of the table.

For best performance, call IMAPITable::SetColumns to customize the table's column set and IMAPITable::Restrict to limit the number of rows in the table before calling SortTable to perform the sort.

If SortTable fails, the sort order that was in effect before the failure remains in effect.

For performance reasons, sort operations are not executed until a subsequent query takes place.

Requirements

Header

mapidefs.h

Library

cemapi.lib

See Also

Reference

IMAPITable