Edit

Share via


DeleteRuleOperation Class

Definition

Represents an operation to delete an Inbox rule.

public ref class DeleteRuleOperation sealed : Microsoft::Exchange::WebServices::Data::RuleOperation
public sealed class DeleteRuleOperation : Microsoft.Exchange.WebServices.Data.RuleOperation
Public NotInheritable Class DeleteRuleOperation
Inherits RuleOperation
Inheritance
DeleteRuleOperation

Examples

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);
    }
}

Remarks

You can delete an existing Rule class object by using this class.

This class derives from the RuleOperation class.

Constructors

DeleteRuleOperation()

Initializes a new instance of the DeleteRuleOperation class.

DeleteRuleOperation(String)

Initializes a new instance of the DeleteRuleOperation class with the specified rule identifier.

Properties

RuleId

Gets or sets the unique identifier of the rule to be deleted.

Applies to