Table.Sort (Outlook)

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.

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 further 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.

Sort (SortProperty, Descending)


Sub SortTableByReceivedTime() 
 
 Dim oT As Outlook.Table 
 
 Dim oRow As Outlook.Row 
 
 Set oT = Session.GetDefaultFolder(olFolderInbox).GetTable 
 
 'Add normalized subject (subject without RE:, FW: and other prefixes)to the column set 
 
 oT.Columns.Add ("http://schemas.microsoft.com/mapi/proptag/0x0E1D001E") 
 
 
 
 'Sort by ReceivedTime in descending order 
 
 oT.Sort "[ReceivedTime]", True 
 
 
 
 Do Until oT.EndOfTable 
 
 Set oRow = oT.GetNextRow 
 
 'Print the normalized subject of each row 
 
 Debug.Print oRow("http://schemas.microsoft.com/mapi/proptag/0x0E1D001E") 
 
 Loop 
 
End Sub

Arguments

The following argument is required

SortProperty (String) - Specifies the property to use to sort the rows of the Table.

Optional arguments

The following argument is optional

Descending (Boolean) - Whether to sort the Table in descending order.