

HOW TO CREATE RULES IN OUTLOOK 2016 CODE
The code above grabs the name of the rule to run from the combo-box and executes the rule on the currently open folder in the Outlook Explorer, if it finds mails with the words "Order" or "Orders" in their subject lines it then moves them to the Orders folder. private void AddinModule_AddinStartupComplete ( object sender, EventArgs e ) You’ll need to wrap it inside a try-catch as the GetRules() method of the Store object will raise an exception if the user is not connected to Microsoft Exchange or if they are disconnected. We then get a reference to the Outlook Rules collection and create our rule, its conditions and actions. The following code first checks whether our Rule already exists, if not, we then check whether the destination “Orders” folder exists and if it does not exist, we create it. In this example we’ll create a rule that will check for all mail items in a folder that contains the words “Order” or “Orders” and then move those mail items to a sub-folder in our Outlook root folder. Each Rule within the Rules collection has a collection of RuleActions and RuleConditions. All the current users’ rules are stored in the Store objects’ Rules collection property. Programmatically creating an Outlook rule is pretty straight-forward once you understand the object hierarchy and how all the pieces fit together. Next, select your programming language (its C# for this project), minimum supported version of Office (I’m selecting Office 2007, since the new rules object model was only introduced in Outlook 2007, and my plug-in will work in Outlook 2007, 20) and Microsoft Outlook as the supported application and finish the wizard.Ĭreating the Outlook rule programmatically If you’re wondering why my Visual Studio 2012’s colour scheme looks different than the default colour scheme, have a look at the Visual Studio 2012 Color Theme Editor. We’ll start by creating a new ADX COM Add-in project in Visual Studio 2012 with Add-in Express for Office and. Creating the Outlook add-in project in Visual Studio
HOW TO CREATE RULES IN OUTLOOK 2016 HOW TO
In this article we’ll explore aspects of the rule object model and I’ll show you how to create your own rule and how to execute rules on demand on any folder in Outlook 2007, 20. Many Outlook programmers do not realise that Microsoft introduced a new rules object model in Outlook 2007 allowing developers to harness the power of Outlook rules. The Microsoft Outlook Rules is a very powerful feature that can sometimes get lost amongst the myriad other features and abilities of Outlook.
