Platform SDK: CDO 1.2.1 |
The Sort method sorts the collection on the specified property according to the specified sort order.
objMsgColl.Sort( [SortOrder] [, PropTag] )
objMsgColl.Sort( [SortOrder] [, name] )
Value | Numeric value | Description |
---|---|---|
CdoNone | 0 | No sort |
CdoAscending | 1 | Ascending sort (default) |
CdoDescending | 2 | Descending sort |
Both parameters are optional. If SortOrder is not specified, ascending order is used. If neither PropTag nor name is specified, the property used in the previous call to Sort is used again. If Sort has never been called on this collection during this session, the MAPI property CdoPR_MESSAGE_DELIVERY_TIME is used for the sort.
Each call to Sort generates an entirely new sort order based on the specified property. No previous sort order is retained or nested.
If the Messages collection was instantiated by a CDO rendering application, a view has been applied to the folder and the collection is already sorted on the property or properties specified by the view. If the Messages collection is in a calendar folder, the AppointmentItem objects are already sorted on CdoPR_START_DATE and cannot be sorted on any other property. An attempt do so when running with Microsoft® Outlook™ returns CdoE_TOO_COMPLEX. Any call to Sort in a calendar folder when running with Microsoft Schedule+ returns CdoE_NO_SUPPORT. MeetingItem objects, however, can be sorted just like Message objects.
If the underlying messaging system does not support the sort criteria specified, for example descending order or MAPI named properties, the Sort method returns CdoE_TOO_COMPLEX.