'Deploy/programmatically create Outlook Rule to run Script

I need to deploy an Outlook rule that runs a script. So in other words I need deploy both an Outlook rule and the script it runs. I know I can get users to import the rwz rule file and maybe paste in the script, but I wondered if there was a more user friendly way.

I started writing a C# program to create the rule, but I cannot see a way to set the action to run a script. Is this possible?

Cheers, Jamie



Solution 1:[1]

The Rules Wizard (and .rwz files in particular) are a dead end as far as deployment is concerned.

According to the MSDN article on Specifying Rule Actions, the "start a script" rule cannot be created programmatically, so that's not an option either.

You need to start looking into different options. As going the C# way seems an option, those include:

  • Replacing the "rule" by an add-in that handles the same events that trigger the rule conditions, the executes the desired "script" code.
  • Replacing both the rule AND the script by the add-in.
  • If you are on Exchange, there are rules and triggers on that level too that have some more options.

We can't really advice you on the most appropriate route unless you share some more detail on what it is your rule and script are doing.

Solution 2:[2]

The library https://github.com/hughbe/OutlookRulesReader contains a specification and reference implementation library (in Swift) for reading and writing Outlook Rules Files

A full description of the format can be found here

Solution 3:[3]

Based on the work of Hugh Bellamy, Outlook Redemption library (I am its author) as of version 6.0 fully supports client side rules (along with import and export of RWZ files) through the RDOClientRules collection.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 H Bellamy
Solution 3 Dmitry Streblechenko