Class FormNameRuleCondition (Outlook VBA)

The class FormNameRuleCondition represents a rule condition that evaluates whether a form name was used to send or receive an item. To use a FormNameRuleCondition class variable it first needs to be instantiated, for example


Dim fnr as FormNameRuleCondition
Set fnr = 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.FormName.Class

ConditionType

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

The form name 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.FormName.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.FormName.Enabled = True

FormName

Returns or sets an Object that represents an array of form identifiers to be evaluated by the rule condition.

Even though the Rules and Alerts Wizard uses the display name of a form as an identifier, programmatically, FormName uses the message class of the form as an identifier. You can assign an array with one string or an array of multiple strings to the FormName property. Multiple form identifiers assigned in an array are evaluated using the logical OR operation. FormName returns an error if it contains one or more empty strings.


Session.DefaultStore.GetRules(1).Exceptions.FormName.FormName =

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: