Share via


_Items.Sort Method

Sorts the collection of items by the specified property. The index for the collection is reset to 1 upon completion of this method.

Namespace:  Microsoft.Office.Interop.Outlook
Assembly:  Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)

Syntax

'Declaration
<DispIdAttribute()> _
Sub Sort ( _
    Property As String, _
    Descending As Object _
)
'Usage
Dim instance As _Items
Dim Property As String
Dim Descending As Object

instance.Sort(Property, Descending)
[DispIdAttribute()]
void Sort(
    string Property,
    Object Descending
)

Parameters

  • Property
    Type: System.String

    The name of the property by which to sort, which may be enclosed in brackets, for example, "[CompanyName]". User-defined properties that contain spaces must be enclosed in brackets. May not be a user-defined property of type keywords, and may not be a multi-valued property, such as a category. For user-defined properties, the property must exist in the UserDefinedProperties collection for _Items.Parent, which represents the Folder object that contains the items.

  • Descending
    Type: System.Object

    True to sort in descending order. The default value is False (ascending).

Remarks

Sort only affects the order of items in a collection. It does not affect the order of items in an explorer view.

Sort cannot be used and will cause an error if the property paramater is one of the following properties:

Categories

LastFirstSpaceOnly

Children

LastFirstSpaceOnlyCompany

Class

MemberCount

CompanyLastFirstNoSpace

NetMeetingAlias

CompanyLastFirstSpaceOnly

RecurrenceState

DLName

ResponseState

LastFirstAndSuffix

Saved

LastFirstNoSpace

Sent

LastFirstNoSpaceCompany

See Also

Reference

_Items Interface

_Items Members

Microsoft.Office.Interop.Outlook Namespace

Other Resources

How to: Filter Recurring Appointments and Search for a String in the Subject