Hi,
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.
Thanks
Hi Mark,
<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 =
GetAsposeEWSClient();<o:p></o:p>
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"
newRules.ContainsSubjectStrings.Add("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
newActions.MoveToFolder = "120:OGIyLTAwNTgzNjRhN2EzNgAuAAAAAABAAMkADFjMjNjMmNjLWE3NzgtNGIzNC05bwP+Tkhs0TKx1GMf0D/cPAQD2lptUqri0QqRtJVHwOKJDAAACL5KNAAA=AQAAAA==";
// Add the actions
rule.Actions = newActions;
// Create the rule now
client.CreateInboxRule(rule);