Table.Sort Method
Outlook Developer Reference |
Sorts the rows of the Table by the property specified in
SortProperty
and resets the current row to just before the first row in the Table.
Version Information
Version Added: Outlook 2007
Syntax
expression.Sort(SortProperty, Descending)
expression A variable that represents a Table object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
SortProperty | Required | String | Specifies the property to use to sort the rows of the Table. |
Descending | Optional | Boolean | Whether to sort the Table in descending order. |
Remarks
SortProperty
can be any explicit built-in property or custom property, with the exception of binary and multi-valued properties. The property must be referenced by its explicit string name; it cannot be referenced by namespace. For futher information on specifying sort properties, see Sorting Items in a Folder.
Sorting the table is equivalent to calling a MoveToStart method. The cursor will be positioned to the start of the Table.
If Table.Sort and then Table.Restrict are called, the filtered items in the new Table will be sorted by the same
SortProperty
and
SortOrder
.
Table.Sort only supports sorting on a single column.
Example
The following code sample shows how to sort the rows in a Table based on the ReceivedTime property, and prints the value of the MAPI normalized subject property for each row in the sorted table.
Visual Basic for Applications |
---|
|
See Also