【发布时间】:2017-01-13 12:16:40
【问题描述】:
如何针对不同的商店运行规则?
我可以使用...访问我的规则并从默认存储中执行它们
Set storeRules = Application.Session.DefaultStore.GetRules()
For Each storeRule In storeRules
If storeRule.name = name Then
storeRule.Execute ShowProgress:=True
End If
Next
但我看不到如何针对共享帐户使用规则。
我可以通过Outlook客户端手动运行,“Run Rules Now”,在“Run In Folder”浏览器中选择正确的文件夹
更新:
尝试遍历我所有的商店,我有三个商店。 ExchangeStoreType 是一个 0 - 主 Exchange 邮箱、一个 2 - Exchange 公用文件夹 (PF?) 和一个 1 - Exchange 委托邮箱。我正在尝试对最后一个运行规则,但委托文件夹上的 .GetRules 没有找到任何规则
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
Debug.Print "... store: " & storeRule.name
Next
Next
End Sub
如果我通过 Outlook UI 并选择该商店,我可以运行规则
【问题讨论】:
-
你确定你访问的是邮箱存储,而不是 PF?
-
检查 ExchangeStoreType,我有三个存储,一个 0 - 主 Exchange 邮箱,一个 2 - Exchange 公用文件夹 (PF?) 和一个 1 - Exchange 委托邮箱。我想对代理邮箱运行规则,但它没有任何规则???
-
你是否在 OutlookSpy 中使用该存储中的规则(转到收件箱文件夹,单击 IMAPIFolder,PR_RULES_TABLE 选项卡)。
-
不... OutlookSpy 针对我的收件箱显示规则选项卡,但不针对委派的收件箱显示规则选项卡
-
关闭缓存会有影响吗?
标签: vba outlook outlook-2010