Class AddressRuleCondition (Outlook VBA)
The class AddressRuleCondition represents a rule condition that evaluates whether the address for the recipient or sender of the message is contained in the address specified in AddressRuleCondition.Address. To use a AddressRuleCondition class variable it first needs to be instantiated, for example
Dim arc as AddressRuleCondition
Set arc = Session.DefaultStore.GetRules(1).Exceptions
Address
Returns or sets an array of String elements to evaluate the address rule condition. Read/write.
You can assign an array with one element to evaluate a single address or an array of multiple strings to evaluate multiple addresses. Multiple address strings assigned in an array are evaluated using the logical OR operation. If a string specified by Address is contained in the recipient or sender address, the condition evaluates to True.
Session.DefaultStore.GetRules(1).Exceptions.RecipientAddress.Address =
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.RecipientAddress.Class
ConditionType
Returns a constant from the OlRuleConditionType enumeration that indicates the type of rule condition. Here you can find possible values for
The AddressRuleCondition object is used by rules of types olRuleSend and olRuleReceive. If the rule is created as an olRuleSend rule, then the type of the associated AddressRuleCondition object will be olConditionSenderAddress. If the rule is created as an olRuleReceive rule, then the type of the associated AddressRuleCondition object will be olConditionRecipientAddress. This however does not mean that the rule always has a defined rule condition for sender or recipient addresses. Regardless of whether there exists such a defined or enabled rule condition, the AddressRuleCondition.ConditionType property is always initialized once the associated rule is created. For more information on rule conditions, see Specify Rule Conditions.
Dim orcConditionType As OlRuleConditionType
orcConditionType = Session.DefaultStore.GetRules(1).Exceptions.RecipientAddress.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.
Session.DefaultStore.GetRules(1).Exceptions.RecipientAddress.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 do the same function: