Class TextRuleCondition (Outlook VBA)

The class TextRuleCondition represents a rule condition that the part of the message, which can be the body, header, or subject, as specified by TextRuleCondition.ConditionType, contains the words specified in TextRuleCondition.Text. To use a TextRuleCondition class variable it first needs to be instantiated, for example


Dim trc as TextRuleCondition
Set trc = Session.DefaultStore.GetRules(1).Exceptions

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).Exceptions.Body.Class

ConditionType

Returns a constant from the OlRuleConditionType enumeration that indicates the type of rule condition. Here you can find possible values for OlRuleConditionType.

The value of ConditionType depends on the type of rule condition, as several types of rule conditions use the TextRuleCondition object: olConditionBody, olConditionBodyOrSubject, olConditionMessageHeader, and olConditionSubject. Except for olConditionMessageHeader, which is supported only by rules for receiving messages, all these types of conditions are supported by rules for receiving messages as well as rules for sending messages. For more information, see Specify Rule Conditions.


Dim orcConditionType As OlRuleConditionType
orcConditionType = Session.DefaultStore.GetRules(1).Exceptions.Body.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 have been saved successfully. Returns an error if you attempt to enable a rule condition that is supported only on a rule of type olRuleSend for a rule of type olRuleReceive, or vice versa. For more information on suppport by rules for receiving messages or rules for sending messages, see Specify Rule Conditions.


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

Text

Returns or sets an array of String elements that represents the text to be evaluated by the rule condition. Read/write.

You can assign an array with one string or multiple strings for evaluation. Multiple text strings assigned in an array are evaluated using the logical OR operation.


Session.DefaultStore.GetRules(1).Exceptions.Body.Text =