Partager via


_Rule.Enabled Property

Returns or sets a Boolean value (bool in C#) that determines if the rule is to be applied. Read/write.

Namespace:  Microsoft.Office.Interop.Outlook
Assembly:  Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)

Syntax

'Declaration
<DispIdAttribute()> _
Property Enabled As Boolean
    Get
    Set
'Usage
Dim instance As _Rule
Dim value As Boolean

value = instance.Enabled

instance.Enabled = value
[DispIdAttribute()]
bool Enabled { get; set; }

Property Value

Type: System.Boolean

Remarks

Setting the Enabled property of a rule does not guarantee that the rule will be enabled. The rule is enabled only after _Rules.Save executes successfully.

Using Rule.Enabled and Rules.Save applies the rule consistently and persists the rules beyond the current session. Enabling a rule (that has been saved successfully) ensures that the rule will be applied. If it is a local client rule, the rule will be applied when Outlook is running, and if the rule is a server-based rule, it will be applied regardless of whether Outlook is running. If you do not enable the rule, then the rule is defined, but it will not be applied. However, you can use _Rule.Execute to apply a rule as an one-off operation regardless of whether the rule is enabled.

See Also

Reference

_Rule Interface

_Rule Members

Microsoft.Office.Interop.Outlook Namespace

Other Resources

How to: Create a Rule to File Mail Items from a Manager and Flag Them for Follow-Up

How to: Execute a Rule Instantly