As I said, you cannot use an addin to create a hidden rule, there is no such
thing.
You would use code in an addin to replicate what your rule does, under the
same conditions. Since a rule runs when items are added to the Inbox, you
need an ItemAdd() handler for Inbox.Items or a handler for NewMailEx(). Then
you would test the incoming item for the same conditions the rule would test
for, and take the same action the rule would take. In this case you would
test the subject for certain text and move the item if the test was true.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
" nitwalkegmail.com.43y68a@invalid wrote in message
news:nitwalkegmail.com.43y68a@invalid...
Thanks for reply,
How can we use COM addin to replace the rule?Can I get some example? or
more explanation.
I have created COM addin and used rule object and rule can seen in rule
wizard.
Outlook.MAPIFolder inbox=
this.Application.Session.GetDefaultFolder(Microsof t.Office.Interop.Outlook.OlDefaultFolders.olFolder Inbox);
Outlook.MAPIFolder targetfolder = inbox.Folders["Test"];
rules = this.Application.Session.DefaultStore.GetRules();
rule = rules.Create("TestRule",
Microsoft.Office.Interop.Outlook.OlRuleType.olRule Receive);
Outlook.TextRuleCondition sub = rule.Conditions.Subject;
sub.Enabled = true;
sub.Text = new string[] {"Test Subject"};
movecopy = rule.Actions.MoveToFolder;
movecopy.Enabled = true;
movecopy.Folder = targetfolder;
rule.Execute(true, inbox, false,
Outlook.OlRuleExecuteOption.olRuleExecuteUnreadMes sages);
How COM addin can use to create hidden rule?