Click here to Skip to main content
15,867,851 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi everyone,

I am encountering the situation that I am sure lots of people have encountered when they've backed up their files, documents, and settings, and then wiped the hard drive, reinstalled Windows and reinstalled Office and all that and restored all files and settings.

I have done this to my Windows 7 computer running Office 2010, and now all my Outlook rules (or most of them) show up in red in the Rules Manager (Rules Wizard?) saying "rule in error." I know that the cause of this is basically, down in the magic of the Outlook black box, Outlook has basically gotten fresh GUIDs or EntryIDs or whatevers for all my Inbox folders and now the fresh GUIDs/whatevers do not match what probably has been stored in the rules to refer to the same folder (lots of the rules which are erroring are the ones where "if the message has XZY in the subject, move to the ABC folder."

Normally, the fix is to open Rules Wizard/manager whatever, click each red rule in turn, and then click on the folder name, use the Outlook-provided Select folder box to basically select the same folder with the mouse, and now the rule turns black and works, check the check box to 'enable' the rule, and then click OK.

I don't want to do this all umpteen-hundred times I'd have to -- it'd drive me batty. So, my thought was to whip out Visual Studio and C# and write Outlook Interop code using Microsoft.Office.Outlook.Interop.dll and friends, and make a console app/script to loop through each rule in turn and identify, and then fix the erroneous ones, maybe to fix the EntryID or whatever is causing the rule to turn red.

I am throwing up my hands and give up. Does anyone have a suggestion? I have found a software called "Power Rules Manager" from Sperry Software, but it's crap -- their GridView does not work, you click on a rule to edit it and it gives you the edit screen for some other list entry and just using it a little while threatens to corrupt your rules -- however, it is some how able to tell which rules are "showing up colored in red"/broken in Outlook. How is it doing that? What part of the Outlook Object Model is it even using do you think?

Thanks in advance for any help!

Brian Hart

What I have tried:

When I pop open MSDN website and pore through the Outlook Object Model and specifically the classes/interfaces on rules, it's fairly straightforward to new up a Outlook.Application reference, then grab a reference to the Store, then the Rules collection and then loop through each Rule in turn.

I have Google-searched this to high heaven but, when I go through the Google results, all I get are how to fix rules where there is a VBA Script action and you have a typo in your VBA code, which is set to be executed when the rule condition is met; not at all the problem I am having.

When I go through the properties/methods of the Rule, RuleConditions, RuleCondition, and RuleAction interfaces, I am not able to discern which methods/properties tell you (a) basically, "This rule is colored red in the rules wizard because of X, Y, and Z reason," or "This rule has problems with it," and, for a rule I know is colored red in Outlook, when I breakpoint on that specific rule in the loop and hover over the interface's methods and properties in Visual Studio, there isn't anything wrong with the rule that I can see -- EntryIDs for the folders I've set the mails to be moved to in my RuleActions match exactly the EntryIDs for the actual PST folder itself, and so do StoreIDs and any kind of ID I can find, all match between the corresponding rule and the corresponding PST folder.
Posted
Comments
RedDk 6-Aug-17 1:48am    
I think you are describing a reinstallation of Office Outlook on a new drive where you then use a backup of the previous system to restore this reinstall to the former settings, yes?

But then, 'might not be it either; you start dancing around C# and VS and I'm no longer sure what the goal your procedure is. So let me ask you a question. Can you find C:\Users\<?>\AppData\Roaming\Microsoft\Outlook\VbaProject.otm in both the backup AND your current setup?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900