We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Creating rules using Exchange


Is it possible that we can create defined rules for mailbox using EWS? e.g. if I want to create a rule for inbox for a message, can I use your EWS for this purpose? I could not find any example in documentation for this.


Hi Mark,

Thank you for writing to us.

Please give try to the following code sample for adding rule to your inbox and let us know your feedback.

<span style=“font-size:
10.0pt;font-family:“Courier New”;color:teal;mso-no-proof:yes”>ExchangeWebServiceClient<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”> client =

Console.WriteLine("Connected to Exchange 2010");

InboxRule rule = new InboxRule();

rule.DisplayName = "Message from client ABC";

// Add conditions

RulePredicates newRules = new RulePredicates();

// Subject contains string "ABC"


// From address is administrator@ex2010.local

newRules.FromAddresses.Add(new MailAddress("administrator@ex2010.local", true));

// Add the conditions

rule.Conditions = newRules;

// Add Actions

RuleActions newActions = new RuleActions();

// Move the message to a folder


// Add the actions

rule.Actions = newActions;

// Create the rule now