This project has moved and is read-only. For the latest updates, please go here.

How to remove a outlook rule?

Jul 7, 2011 at 5:28 AM


        I  want to delete a outlook rule with Outlook._Rules.Remove(),but it doesn't seem to work.

        VS2010 doesn't show any problem but the rule which name is "AAA" still existes in my Outlook.

// pls read following program         


 Outlook.Application outlookApp = new Outlook.Application();

Outlook._NameSpace outlookNS = outlookApp.GetNamespace("MAPI");

Outlook.Rules rules = outlookNS.DefaultStore.GetRules();
MessageBox.Show("Rules count is:"+rules.Count);

 for(int k=1;k<=rules.Count;k++)
                Outlook._Rule rule = rules[k];

                    Object ccc=(Object)rule.Name;
                    MessageBox.Show("Remove it");