Sort Method (AddressEntries Collection)

Sort Method (AddressEntries Collection)

The Sort method sorts the collection on the specified property according to the specified sort order.

Syntax

objAddrEntriesColl .Sort( [ SortOrder ] [ , PropTag ] )

objAddrEntriesColl .Sort( [ SortOrder ] [ , name ] )

objAddrEntriesColl

Required. The AddressEntries collection object.

SortOrder

Optional. Long. The specified sort order, one of the following values:

Value

Numeric value

Description

CdoNone

0

No sort

CdoAscending

1

Ascending sort (default)

CdoDescending

2

Descending sort

PropTag

Optional. Long. The property tag value for the MAPI property to be used for the sort. PropTag is the 32-bit MAPI property tag associated with the property, such as CdoPR_EMAIL_ADDRESS.

name

Optional. String. The custom property name of a MAPI named property.

Remarks

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

See Also

Concepts

AddressEntries Collection Object