将对象存储 (Outlook)

Store 对象的集合,代表当前配置文件中提供的所有存储区。

备注

使用 StoresStore 对象枚举当前会话中所有存储区的所有文件夹和搜索文件夹。 有关在文件夹和存储区中存储 Outlook 项目的详细信息,请参阅存储 Outlook 项目

示例

以下 Microsoft Visual Basic for Applications (VBA) 代码示例枚举某个会话的所有存储区上的所有文件夹:

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

事件

名称
BeforeStoreRemove
StoreAdd

方法

名称

属性

名称
Application
Count
Parent
Session

另请参阅

Outlook 对象模型引用存储对象成员

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。