Programatically Add Rule in Outlook

Add-in Express™ Support Service
That's what is more important than anything else

Programatically Add Rule in Outlook
 
Ed Salgado




Posts: 16
Joined: 2010-06-17
I searched the forum and the keyword "Rule" comes up with lots of entries, but I can't seem to find this one...

Is there a way to programatically add a Rule to Outlook?

Thanks!

-ed
Posted 07 Jul, 2010 15:26:45 Top
Andrei Smolin


Add-in Express team


Posts: 18816
Joined: 2006-05-11
Hi Ed,

Outlook 2007+ allows you to create a rule programmatically. The pathway is: Namespace.Stores, Store.GetRules, Rules.Create.


Andrei Smolin
Add-in Express Team Leader
Posted 08 Jul, 2010 02:08:40 Top
Ed Salgado




Posts: 16
Joined: 2010-06-17
Andrei,

Thanks! It occurred to me that I could also move mail items when they come into the inbox through an event. Is there an event I can hook into to check incoming mail and move the desired mail items into my folder?

Thanks!

-ed
Posted 08 Jul, 2010 11:09:59 Top
Andrei Smolin


Add-in Express team


Posts: 18816
Joined: 2006-05-11
Ed,

You can handle the ItemAdd event of the Items collection of that folder.


Andrei Smolin
Add-in Express Team Leader
Posted 09 Jul, 2010 10:58:15 Top
Ed Salgado




Posts: 16
Joined: 2010-06-17
Andrei,

Do you have some sample code on how to programmatically move a mail item from one folder to another?

Thanks!

-ed
Posted 19 Jul, 2010 10:42:28 Top
Andrei Smolin


Add-in Express team


Posts: 18816
Joined: 2006-05-11
Hi Ed,

I don't have such code. Please see TMailUtem.Move.


Andrei Smolin
Add-in Express Team Leader
Posted 19 Jul, 2010 11:16:02 Top
Andrei Smolin


Add-in Express team


Posts: 18816
Joined: 2006-05-11
Sorry, TMAilItem.Move, not TMailUtem.Move :)


Andrei Smolin
Add-in Express Team Leader
Posted 19 Jul, 2010 11:19:45 Top
Ed Salgado




Posts: 16
Joined: 2010-06-17
Andrei,

Thanks! Works like a champ. I think I'm just about done with my plug-in! Works great! Really do appreciate all the help!

-ed
Posted 19 Jul, 2010 11:27:52 Top