_Rules.Create Method
Creates a Rule object with the name specified by Name and the type of rule specified by RuleType.
Namespace: Microsoft.Office.Interop.Outlook
Assembly: Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)
Syntax
'Declaration
<DispIdAttribute()> _
Function Create ( _
Name As String, _
RuleType As OlRuleType _
) As Rule
'Usage
Dim instance As _Rules
Dim Name As String
Dim RuleType As OlRuleType
Dim returnValue As Rule
returnValue = instance.Create(Name, RuleType)
[DispIdAttribute()]
Rule Create(
string Name,
OlRuleType RuleType
)
Parameters
Name
Type: System.StringA string identifier for the rule, which will be represented by _Rule.Name after rule creation. Names of rules in a collection are not unique.
RuleType
Type: Microsoft.Office.Interop.Outlook.OlRuleTypeA constant in the OlRuleType enumeration that determines whether the rule is applied on sending or receiving a message.
Return Value
Type: Microsoft.Office.Interop.Outlook.Rule
A Rule object that represents the newly created rule.
Remarks
The RuleType parameter of the added rule determines valid rule actions, rule conditions, and rule exception conditions that can be associated with the Rule object.
When a rule is added to the collection, the _Rule.ExecutionOrder of the new rule is 1. The ExecutionOrder of other rules in the collection is incremented by 1.
See Also
Reference
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