How to delete corrupted, hidden inbox rules from a mailbox using MFCMAPI

This is useful when you receive duplicate messages or any of the inbox rules are corrupted or not working as expected. I have included related KB article below for reference.

https://support.microsoft.com/en-us/kb/924297

 
1. Export all rules from you Outlook so that you may import them back after deleting all rules via MFCMAPI.

    On your Outlook client, go to “File”> “ManageRules & Alerts”.


  
  2. Under E-mail Rules > go to “Options” > Export Rules > “Ok”.


   
3.    Download the latest version of MFCMAPI from the link below

       (Please make sure you download the correct release for your Outlook client e.g. 32bit or 64bit version).

       https://mfcmapi.codeplex.com/

4. Start MFCMAPI.EXE as Administrator.

5. Go to “Tools” > “Options”.

6. Make sure that “Use the MDB_ONLINE flag when calling OpenMsgStore

    And “Use the MAPI_NO_CACHE flag when calling OpenEntry” are checked. Click “OK”.


   
 7. Click on “Session” > “Logon”.

8. Choose the Outlook profile contains the rules you want to delete > “OK”.


   
 9. Double click the profile with rules you want to delete.

10. Expand “Root Container” > Scroll down > Expand “Top Information Store”.

      Then right click “Inbox” > “Open associated contents table”.


   
11. Locate and click the items that have the IPM.Rule.Version2.Message as a “Message Class

      Select all messages you want to delete > Right click > “Delete message”.

12. Choose “Permanent delete passing DELETE_HARD_DELETE (unrecoverable)" >Ok”.

13. Once all rules have been deleted, you may import the inbox rules back or create new ones.