Create Outlook 2000/XP/2003 Rules in Deployment

  • Thread starter Thread starter John Stratoudakis
  • Start date Start date
J

John Stratoudakis

Hi all,

I am writing an Outlook Plug-In that filters all incoming mail for
SPAM. So I am trying to figure out how to create an Outlook Rule (to
call my code and dll) programmatically.

So, does anybody know how to create an Outlook Rule programmatically,
or how to copy an Outlook 2000 rule to another computer that is running
Outlook 2000, XP or 2003?

Thanks
John Stratoudakis
 
It's not really practical. While there is a Rule.dll COM component that you can use with CDO 1.21 (see http://www.outlookcode.com/d/exstech.htm) to create rules, all it can do is create very simple server-based rules. On top of that, the rules it creates are not visible to the user, so they can lead to support problems as users become perplexed as to why things aren't going where they expect.
 
I know, its a pretty big bummer.

What I am going to do is include an exported rule with my installation
package and instruct the users to import that rule if they want my
program to run on every single message automatically. I still havent
checked on whether or not an outlook 2000 rule can be imported by
outlook XP or 2003, but I'm sure it will not be that difficult, and if
it is, I'll just deploy a different copy of the rule for different
versions of Outlook.

By the way, I recently bought your book, and I have to say it is great.
I have learned so much about Outlook programming from the books
website, and one day I decided that I should buy it so I can have
access to all the sample programs, and it has turned out great for me
so far.

Thanks and I'll post my findings for importing rules into outlook when
I figure it all out.
 
Great! I'd be very interested to hear what happens when you cross versions.
 
well, I was able to successfully import my Outlook rules that were
exported from Outlook 2000 to Outlook 2003, the only difference is that
Outlook 2003 automatically detected rules with errors in them and
disabled them.

Now if only there was a command line option/method of doing this. And
I'm pretty sure that you can do it if you call the proper API
functions, so I will take a quick hunt in the MSDN for this.
 
Here are my results,

I created an outlook rule that uses a custom action in Outlook 2000.

I exported this rule to a file named NoName.rwz

----------------------------------------
Went to a different computer

I then added code to my addin to add the proper registry key for
registering the custom action in outlook under:
HKEY_LOCAL_MACHINE\Software\Microsoft\Exchange\Client\Custom Actions

then loading both outlook XP and 2003 and importing the rule worked! It
was able to properly import the rule and to set the custom action to
what I had it set on the original Outlook 2000 machine.

What this means is that you can add the registry key for the outlook
custom action after loading outlook, and outlook will still know that
that custom action exists... Now only if there was a way to add the
stupid rule automatically to your outlook pst file, because I have read
that outlook XP and 2003 rules are stored in the users pst file.

As for outlook 2000, I was able to simply copy the exported .RWZ file
to the users application data folder:
\Application Data\Microsoft\Outlook

So, I guess this means I can automatically deploy my rule and
application without requiring user interaction on oulook 2000. But for
Outlook XP and 2003, I will have to instruct the user to import the
rule... now maybe I can have the wizard popup or something like that
when outlook first loads.
 
Back
Top