Class AssignToCategoryRuleAction (Outlook VBA)

The class AssignToCategoryRuleAction represents an action that assigns categories to a message. To use a AssignToCategoryRuleAction class variable it first needs to be instantiated, for example


Dim atc as AssignToCategoryRuleAction
Set atc = Session.DefaultStore.GetRules(1).Actions

ActionType

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

The category assigning rule action is supported by rules for receiving messages and rules for sending messages. For more information, see Specifying Rule Actions.


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

Categories

Returns or sets an array of strings representing the categories assigned to the message. Read/write.

You can assign an array with one element for a single category or an array of strings for multiple categories. Outlook does not check to determine if the Categories property contains category names that are in the master category list. This property uses the character specified in the value name, sList, under HKEY_CURRENT_USER\Control Panel\International in the Windows registry, as the delimiter for multiple categories.


Session.DefaultStore.GetRules(1).Actions.AssignToCategory.Categories =

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.AssignToCategory.Class

Enabled

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

After you enable a rule, you must also save the rule by using Rules.Save so that the rule and its enabled state will persist beyond the current session. A rule is only enabled after it has been saved successfully.


Session.DefaultStore.GetRules(1).Actions.AssignToCategory.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: