Store object (Outlook)

Represents a file on the local computer or a network drive that stores email messages and other items for an account in the current profile.

Remarks

A profile defines one or more email accounts, and each email account is associated with a server of a specific type. For an Exchange server, a store can be on the server, in an Exchange Public folder, or in a local Personal Folders File (.pst) or Offline Folder File (.ost). For a POP3, IMAP, or HTTP email server, a store is a .pst file.

Use the Stores and Store objects to enumerate all folders and search folders on all stores in the current session. Since getting the root folder or search folders in a store requires the store to be open and opening a store imposes an overhead on performance, you can check the Store.IsOpen property before you decide to pursue the operation.

If you use an Exchange server, you can access other explicit built-in Store properties for store characteristics such as ExchangeStoreType, IsCachedExchange, and IsDataFileStore. Use the PropertyAccessor object returned by Store.PropertyAccessor to access other store properties that are not exposed in the Outlook object model.

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

Methods

Name
GetDefaultFolder
GetRootFolder
GetRules
GetSearchFolders
GetSpecialFolder
RefreshQuotaDisplay
CreateUnifiedGroup
DeleteUnifiedGroup

Properties

Name
Application
Categories
Class
DisplayName
ExchangeStoreType
FilePath
IsCachedExchange
IsConversationEnabled
IsDataFileStore
IsInstantSearchEnabled
IsOpen
Parent
PropertyAccessor
Session
StoreID

See also

Outlook Object Model Reference Store 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.