Share via


GetPrevious Method (Folders Collection)

GetPrevious Method (Folders Collection)

The GetPrevious method returns the previous Folder object in the Folders collection. It returns Nothing if no previous object exists, for example if already positioned at the beginning of the collection.

Syntax

Set objFolder = objFoldersColl.GetPrevious( )

objFolder

On successful return, represents the previous Folder object in the collection.

objFoldersColl

Required. The Folders collection object.

Remarks

The order that items are returned by GetFirst, GetLast, GetNext, and GetPrevious depends on whether the folders are sorted or not. The Folder objects within a collection can be sorted on a MAPI property of your choice, either ascending or descending, using the Sort method. When the items are not sorted, you should not rely on these methods to return the items in any specified order. The best programming approach to use with unsorted collections is to assume that the access functions are able to access all items within the collection, but that the order of the objects is not defined.

If the GetLast method has not been called since the Folders collection was initialized, the behavior of the GetPrevious method is not defined. This can produce unexpected results if the collection is reinitialized with a Set statement in every iteration of a loop. The recommended procedure is to set an explicit variable for the collection before entering the loop. For more information, see Object Collections.

See Also

Concepts

Folders Collection Object