Class RuleAction (Outlook VBA)

The class RuleAction represents an action that is run when a Rule object executes. To use a RuleAction class variable it first needs to be instantiated, for example


Dim ran as RuleAction
Set ran = Session.DefaultStore.GetRules(1).Actions

ActionType

Returns a constant from the OlRuleActionType enumeration that indicates the type of action that is taken by the RuleAction. Here you can find possible values for OlRuleActionType.

For more information on the rule actions supported for programmatic rule creation, those supported for rules for receiving message, and those supported for rules for sending messages, see Specify Rule Actions.


Dim oraActionType As OlRuleActionType
oraActionType = Session.DefaultStore.GetRules(1).Actions.Delete.ActionType

Class

Returns an OlObjectClass constant indicating the object's class. Here you can find possible values for OlObjectClass.


Dim oocsClass As OlObjectClass
oocsClass = Session.DefaultStore.GetRules(1).Actions.Delete.Class

Enabled

Returns or sets a Boolean that determines if the RuleAction is enabled.

After you enable a rule action, you must also save the rule by using Rules.Save so that the rule action and its enabled state will persist beyond the current session. A rule action is only enabled after it has been saved successfully. Returns an error if you attempt to enable a rule action that is supported only on a rule of type olRuleSend for a rule of type olRuleReceive, or vice versa.


Session.DefaultStore.GetRules(1).Actions.Delete.Enabled = True

Session

Returns the NameSpace object for the current session.

The Session property and the GetNamespace method can be used interchangeably to obtain the NameSpace object for the current session. Both members serve the same purpose. For example, the following statements perform the same function: