Class CategoryRuleCondition (Outlook VBA)
The class CategoryRuleCondition represents a rule condition that evaluates categories on a message as compared with CategoryRuleCondition.Categories. To use a CategoryRuleCondition class variable it first needs to be instantiated, for example
Dim crc as CategoryRuleCondition
Set crc = Session.DefaultStore.GetRules(1).Exceptions
Categories
Returns or sets an array of String elements that represents the categories evaluated by the rule condition. Read/write.
You can assign an array with one element to evaluate a single category or an array of multiple strings to evaluate multiple categories. Multiple category strings assigned in an array are evaluated using the logical OR operation. 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. If a string specified by Categories matches a category of the message, the condition evaluates to True. Outlook does not check to determine if the Categories property contains category names that are in the master category list. Returns an error if Categories contains one or more empty strings.
Session.DefaultStore.GetRules(1).Exceptions.Category.Categories =
Class
Returns an OlObjectClass constant indicating the object's class. Here you can find possible values for
Dim oocsClass As OlObjectClass
oocsClass = Session.DefaultStore.GetRules(1).Exceptions.Category.Class
ConditionType
Returns a constant, olConditionCategory, from the OlRuleConditionType enumeration that indicates the type of rule condition. Here you can find possible values for
The category rule condition is supported by rules for receiving messages and rules for sending messages. For more information, see Specify Rule Conditions.
Dim orcConditionType As OlRuleConditionType
orcConditionType = Session.DefaultStore.GetRules(1).Exceptions.Category.ConditionType
Enabled
Returns or sets a Boolean that determines if the rule condition is enabled.
After you enable a rule condition, you must also save the rule by using Rules.Save so that the rule condition and its enabled state will persist beyond the current session. A rule condition is only enabled after it has been saved successfully.
Session.DefaultStore.GetRules(1).Exceptions.Category.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: