Share via


IPOutlookItemCollection::Sort

This method is not supported in Windows CE Platform Builder 3.0.

This item sorts items in a folder based on an item property.

HRESULT Sort( BSTR pwszProperty, VARIANT_BOOL fDescending );

Parameters

  • pwszProperty
    [in] The property on which to sort.
  • fDescending
    [in] Set to TRUE to sort in descending order or FALSE to sort in ascending order.

Return Values

S_OK indicates success. If an error occurs, the appropriate HRESULT value is returned.

Remarks

The default property used to order each type of Items collection depends on the Windows CE platform or version as well as the data type. If you require a particular sort order for an items in a collection, specify it with the Sort method, and do not rely on the default sort order.

You cannot sort on the following properties: Categories, BodyInk, ReminderTime, Recipients.

Code Example [Visual Basic]

The following Visual Basic® code snippet shows how to sort items in a collection in ascending order:

Sub SortItems(polApp As PocketOutlook.Application)
Dim polTasks As PocketOutlook.Items
Set polTasks = polApp.GetDefaultFolder(olFolderCities).Items
polTasks.Sort("[TimezoneIndex]", False)
End Sub

Code Example [C++]

The following C++ code shows how to sort items in a collection in ascending order:

void SortItems(IPOutlookApp *polApp)
{
IPOutlookItemCollection *pItems;
IFolder *pFolder;

// Get the cities Items collection
polApp->GetDefaultFolder(olFolderCities, &pFolder);
pFolder->get_Items(&pItems);

// Sort items
pItems->Sort(TEXT "[TimezoneIndex]", FALSE);

// Release objects
pItems->Release();
pFolder->Release();
}

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 2.0 and later pimstore.h    

See Also

IPOutlookItemCollection::Unknown, IPOutlookItemCollection Property Methods

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.