Partager via


Store.GetSearchFolders Method (Outlook)

Returns a Folders collection object that represents the search folders defined for the Store object.

Version Information

Version Added: Outlook 2007

Syntax

expression .GetSearchFolders

expression A variable that represents a Store object.

Return Value

A Folders collection object that represents all the search folders for the Store object.

Remarks

GetSearchFolders returns all the visible active search folders for the Store. It does not return uninitialized or aged out search folders.

GetSearchFolders returns a Folders collection object with Folders.Count equal zero (0) if no search folders have been defined for the Store.

For a Folders collection object that represents a collection of search folders, Folders.Parent returns the same object as Store.GetRootFolder. Folder.Folders returns Null (Nothing in Visual Basic).

Example

The following code sample in Microsoft Visual Basic for Applications (VBA) enumerates the search folders on all stores for the current session.

Sub EnumerateSearchFoldersInStores() 
 
 Dim colStores As Outlook.Stores 
 
 Dim oStore As Outlook.Store 
 
 Dim oSearchFolders As Outlook.folders 
 
 Dim oFolder As Outlook.Folder 
 
 
 
 On Error Resume Next 
 
 Set colStores = Application.Session.Stores 
 
 For Each oStore In colStores 
 
 Set oSearchFolders = oStore.GetSearchFolders 
 
 For Each oFolder In oSearchFolders 
 
 Debug.Print (oFolder.FolderPath) 
 
 Next 
 
 Next 
 
End Sub

See Also

Concepts

Store Object

Store Object Members