Muokkaa

Jaa


Stores object (Outlook)

A set of Store objects representing all the stores available in the current profile.

Remarks

Use the Stores and Store objects to enumerate all folders and search folders on all stores in the current session. For more information on storing Outlook items in folders and stores, see Storing Outlook Items.

Example

The following code sample in Microsoft Visual Basic for Applications (VBA) enumerates all folders on all stores for a session:

Sub EnumerateFoldersInStores() 
 
 Dim colStores As Outlook.Stores 
 
 Dim oStore As Outlook.Store 
 
 Dim oRoot As Outlook.Folder 
 
 
 
 On Error Resume Next 
 
 Set colStores = Application.Session.Stores 
 
 For Each oStore In colStores 
 
 Set oRoot = oStore.GetRootFolder 
 
 Debug.Print (oRoot.FolderPath) 
 
 EnumerateFolders oRoot 
 
 Next 
 
End Sub 
 
 
 
Private Sub EnumerateFolders(ByVal oFolder As Outlook.Folder) 
 
 Dim folders As Outlook.folders 
 
 Dim Folder As Outlook.Folder 
 
 Dim foldercount As Integer 
 
 
 
 On Error Resume Next 
 
 Set folders = oFolder.folders 
 
 foldercount = folders.Count 
 
 'Check if there are any folders below oFolder 
 
 If foldercount Then 
 
 For Each Folder In folders 
 
 Debug.Print (Folder.FolderPath) 
 
 EnumerateFolders Folder 
 
 Next 
 
 End If 
 
End Sub

Events

Name
BeforeStoreRemove
StoreAdd

Methods

Name
Item

Properties

Name
Application
Class
Count
Parent
Session

See also

Outlook Object Model Reference Stores Object Members

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.