Class ToOrFromRuleCondition (Outlook VBA)
The class ToOrFromRuleCondition represents a rule condition that the sender or the recipients of the message, as specified by ToOrFromRuleCondition.ConditionType, is in the recipients list specified in ToOrFromRuleCondition.Recipients. To use a ToOrFromRuleCondition class variable it first needs to be instantiated, for example
Dim tof as ToOrFromRuleCondition
Set tof = Session.DefaultStore.GetRules(1).Exceptions
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.From.Class
ConditionType
Returns a constant from the OlRuleConditionType enumeration that indicates the type of rule condition. Here you can find possible values for
ConditionType depends on the type of rule condition, as two types of rule conditions use the ToOrFromRuleCondition object: olConditionFrom and olConditionSentTo. olConditionFrom is supported only by rules for receiving messages, while olConditionSentTo is 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.From.ConditionType
Enabled
Returns a Boolean value that indicates whether the rule condition is enabled. Read/write
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.From.Enabled = True
Recipients
Returns a Recipients collection that represents the recipient list for the evaluation of the rule condition.
Multiple recipients are evaluated using the logical OR operation.
Dim rcpsRecipients As Recipients
Set rcpsRecipients = Session.DefaultStore.GetRules(1).Exceptions.From.Recipients
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: