none
AutoFormatRules issue with outlook 2007

    Question

  • Hi

    when we are creating autoformat rules from code we get some serious performacne issues on outlook 2007 with SP3. 

    We have about 20 Rules. When we create the same amount of rules manually we got no problens.

    Without SP3 or with other outlook versions everything works fine.

    On machine when we created a new user this user didnt have the problem altough it was the same machine and nothing chagned on outlook or the formating rules.

    Here is a example code how we do it.

    Microsoft.Office.Interop.Outlook.Folder folder = Application.ActiveExplorer().CurrentFolder as Microsoft.Office.Interop.Outlook.Folder;
            Microsoft.Office.Interop.Outlook.TableView tableview = folder.CurrentView as Microsoft.Office.Interop.Outlook.TableView;
            Microsoft.Office.Interop.Outlook.AutoFormatRules rules = tableview.AutoFormatRules;
    
            for (int i = 0; i < 15; i++)
            {
                Microsoft.Office.Interop.Outlook.AutoFormatRule rule = rules.Add("Test" + i);
                rule.Enabled = true;
                rule.Font.Italic = true;
                rule.Font.Color = MSOutlook.OlColor.olColorRed;
                rule.Filter = "\"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/Testfield/0000001f\" = 'Test" + i + "'";
            }
    
            rules.Save();
            tableview.Save();
            tableview.Apply();

    Can someone give us a hint on how to improve it?

    Any hints?

    Wednesday, February 27, 2013 11:59 AM

Answers