Identify MailItems satisfying a Rule

Is there any way to know which MailItems satisfy a given Rule?

I mean to move a set of emails by applying a Rule (as a one-off operation), but then know which were these.

Upvotes: 0

Views: 50

Answers (2)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66215

You can either parse the rule conditions (Rule.Conditions) and programmatically check if they apply to a particular message, or you can call Rule.Execute and let it do what it needs to do. You can set up event handler on the target folder (Items.ItemAdd) ahead of time to figure out which items were moved to the target folder.

Upvotes: 1

Eugene Astafiev
Eugene Astafiev

Reputation: 49395

You can use the Find/FindNext or Restrict methods to find Outlook items that satisfy to your conditions. Also you may find the AdvancedSearch method of the Application class helpful.

Upvotes: 1

Related Questions