• Subject: AutoFormattingRules and Filter
  • Author: Gilles
  • Date: 14 Sep 2007
  • References:
Hi,
I try to add a formatting rule to the Inbox folder in Outlook 2007 with
VSTO. I can create it by AutoFormattingRule and set filter and font. I
success to create my rule with name and the good font, but the filter doesn't
work. And when I check manually my rule in Outlook, i can find it with the
good font but it hasn't my filter.
Did I miss something ?
This is my code :

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Outlook.TableView view =
(Outlook.TableView)this.Application.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox).CurrentView;
Outlook.AutoFormatRule rule = view.AutoFormatRules.Add("My rule");
rule.Font.Color = Outlook.OlColor.olColorBlue;
rule.Filter = "\"urn:schemas-microsoft-com:office:office#Keywords\" LIKE
'%toto%'";
rule.Enabled = true;
view.Save();
view.Apply();
}

Thanks for you help. I begin to be desperate.
14 Sep 2007AutoFormattingRules and Filter.Gilles
16 Sep 2007\ Re: AutoFormattingRules and Filter.SvenC
17 Sep 2007   \ Re: AutoFormattingRules and Filter.Gilles
17 Sep 2007      \ Re: AutoFormattingRules and Filter.SvenC
17 Sep 2007         \ Re: AutoFormattingRules and Filter.Gilles
17 Sep 2007            \ Re: AutoFormattingRules and Filter.SvenC
17 Sep 2007               \ Re: AutoFormattingRules and Filter.Gilles
All times are in (US) Eastern Daylight Time (GMT -4:00)