如何对具有指定 ExchangeStoreType 的帐户进行 运行 规则?

How to run rules on accounts with specified ExchangeStoreType?

我正在为我的团队监控的多个电子邮件帐户设置自动化。

我为个人帐户创建了自己的规则。我进行了一些谷歌搜索和编辑,使其适用于多个帐户。

这是我不想列出的帐户。

我想为所有输出设置变量,这样我就可以 运行 针对特定帐户制定规则。

Sub RunTest()
Dim storeRules As Outlook.Rules
Dim storeRule As Outlook.Rule
Dim allStores As Outlook.Stores
Dim myStore As Outlook.Store

Set allStores = Application.Session.Stores
For Each myStore In allStores
    On Error Resume Next
    Debug.Print myStore.DisplayName & "  " & myStore.ExchangeStoreType
    Set storeRules = myStore.GetRules()
    For Each storeRule In storeRules
        'storeRule.Execute ShowProgress:=True' 'disabled until code is working'
    Next
Next
End Sub

Debug Log的输出是:(****包含敏感信息)

Public Folders - ****@****.com.au  2
****  1
****  1
**** ****  1
**** **** ****  1
**** ****  1
****@****.com.au  4
****  1
****@****.com.au  0
Public Folders - ****@****.com.au  2

我想 运行 40 的规则。如何为有效数组中的各个项目设置变量?

应用 myStore.ExchangeStoreType 条件。

Option Explicit

Sub RunTest_ExchangeStoreType()

Dim storeRules As Rules
Dim storeRule As Rule
Dim allStores As Stores
Dim myStore As Store

Set allStores = Session.Stores

For Each myStore In allStores
    
    'On Error Resume Next
    'If needed, place just before the expected error.
    'Follow closely with On Error GoTo 0 to return to normal error handling.
    
    Debug.Print myStore.DisplayName & "  " & myStore.ExchangeStoreType
    
    Select Case myStore.ExchangeStoreType
    
        Case 0, 4
            Debug.Print " ExchangeStoreType matched: " _
              & myStore.DisplayName & "  " & myStore.ExchangeStoreType
            
            Set storeRules = myStore.GetRules()
            For Each storeRule In storeRules
                'storeRule.Execute ShowProgress:=True' 'disabled until code is working'
            Next
    
    End Select
    
Next

End Sub