DeleteRuleOperation class
Represents an operation to delete an Inbox rule.
System.Object
Microsoft.Exchange.WebServices.Data.ComplexProperty
Microsoft.Exchange.WebServices.Data.RuleOperation
Microsoft.Exchange.WebServices.Data.DeleteRuleOperation
Microsoft.Exchange.WebServices.Data.ComplexProperty
Microsoft.Exchange.WebServices.Data.RuleOperation
Microsoft.Exchange.WebServices.Data.DeleteRuleOperation
Namespace: Microsoft.Exchange.WebServices.Data
Assembly: Microsoft.Exchange.WebServices (in Microsoft.Exchange.WebServices.dll)
You can delete an existing Rule class object by using this class.
This class derives from the RuleOperation class.
The following example searches the RuleCollection class to find an existing Rule object with the name "MoveInterestingToJunk" from the user's mailbox. If the Rule exists, the Rule is deleted when the service.UpdateInboxRules(new RuleOperation[] { setRuleOperation }, true) line is executed.
// Create the DeleteRuleOperation. // Delete the rule "MoveInterestingToJunk", if it exists. // Get the RuleCollection. RuleCollection ruleCollection = service.GetInboxRules("User1@Contoso.com"); foreach (Rule ruleinCollection in ruleCollection) { if (ruleinCollection.DisplayName == "MoveInterestingToJunk") { DeleteRuleOperation deleteRuleOperation = new DeleteRuleOperation(ruleinCollection.Id); service.UpdateInboxRules(new RuleOperation[] { deleteRuleOperation }, true); } }
Show: