Rule.Execute (Outlook)
Applies a rule as a one-off operation.
Use Rule.Execute to apply a rule as a one-off operation regardless of whether Rule.Enabled is True. Use Rule.Enabled and then Rules.Save if you want to apply the rule consistently and persist the rules beyond the current session. The parameters to the Execute method are optional. If you do not specify any parameters, the rule will be applied to all messages in the Inbox but not to the subfolders of the Inbox. The default values for the optional arguments are as follows:
Execute (ShowProgress, Folder, IncludeSubfolders, RuleExecuteOption)
Session.DefaultStore.GetRules(1).Execute
Arguments
Optional arguments
The following arguments are optional
ShowProgress (Boolean) - True to display the progress dialog box when the rule is executed, False to run the rule without displaying the dialog box.
Folder (Folder) - Represents the folder where the rule will be applied.
IncludeSubfolders (Boolean) - True to apply the rule to subfolders of the folder indicated by the Folder parameter; False to apply the rule only to that folder but not its subfolders.
RuleExecuteOption (OlRuleExecuteOption) - Represents whether to apply the rule to read, unread, or all messages in the folder or folders specified by the Folder and IncludeSubfolders parameters.
Possible return values are olRuleExecuteAllMessages - Executes a rule against all messages in the specified folder or folders, olRuleExecuteReadMessages - Executes a rule against messages that have been read in the specified folder or folders, olRuleExecuteUnreadMessages - Executes a rule against messages that have not been read in the specified folder or folders.