c# - How to check all rules which can be applied to a mailItem in Outlook -
I am writing an application that can be matched with the rules. The only way to check which items are applied ( and ) for each There is an example ( untested ) in this context to match a subject rule ( // New Messages Here are the empty items IITemAdd (Object Items) {// All Rule Rules Rule = Application. Session Default store.gatereal (); Outlook.MailItemmail = (Outlook.MailItem) items; If (mail! = Null) {// I have to find out that mail matches a rule and handle it in a proper way}}
MailItem . Rule engine works by executing each rule you define - it does not provide a mechanism to preview the affected objects.
olConditionSubject ) to you too Will need to handle. {Mailout = null} {foreach (rules in rules) {foreach (rule.Conditions in Outlook. Terms condition condition) {if (condition is TextRuleCondition) {Outlook.TextRuleCondition Trc = betting Outlook.TextRuleCondition; If (trc.ConditionType == Outlook.OlRuleConditionType.olConditionSubject) {/ TODO: Control the rule. Exception statuses boolSubject = mail.Subject.Contains (trc.Text); }}}}}
Comments
Post a Comment