1. Here's a thread that needs an answer: Calendar says it is connected to someone else

Create or Import a Outlook Rule through C# code.

Discussion in 'Outlook VBA and Custom Forms' started by JIGNESH, May 31, 2010.

  1. JIGNESH

    JIGNESH

    Guest
    Outlook 2007

    > .NET 3.5 with VS2008.

    In outlook manually i can create a rule which looks like below. I am looking

    for a code sample which can do the same. Rule is :-

    "Apply this rule after message arrives

    with "ABC" in the subject

    reply using "c:\users\xxxxxx...\Templates\STDReply.oft"

    and delete it"

    if via code its not possible, then I am looking for some code, which can

    help me to import the Rule file containing above rule.

    Any Directions, Clue, Code Sample/ Hit will help.

    Note: I had a looked at Outlook.Rule object, but I could not found my

    solution.

    Regards
  2. Sue Mosher [MVP]

    Sue Mosher [MVP]

    Guest
    Yes, it's possible, using the Outlook.Rule object, which is documented in

    detail here:

    Overview

    http://msdn.microsoft.com/en-us/library/bb206763.aspx

    Rule Conditions

    http://msdn.microsoft.com/en-us/library/bb206766.aspx

    Rule Actions including olRuleActionTemplate and olRuleActionDelete

    http://msdn.microsoft.com/en-us/library/bb206764.aspx

    Sue Mosher,

    "JIGNESH" wrote:


    > Outlook 2007
    > .NET 3.5 with VS2008.

    > In outlook manually i can create a rule which looks like below. I am looking
    > for a code sample which can do the same. Rule is :-

    > "Apply this rule after message arrives
    > with "ABC" in the subject
    > reply using "c:\users\xxxxxx...\Templates\STDReply.oft"
    > and delete it"

    > if via code its not possible, then I am looking for some code, which can
    > help me to import the Rule file containing above rule.

    > Any Directions, Clue, Code Sample/ Hit will help.

    > Note: I had a looked at Outlook.Rule object, but I could not found my
    > solution.

    > Regards
    >
  3. JIGNESH

    JIGNESH

    Guest
    Hi Sue,

    On Page http://msdn.microsoft.com/en-us/library/bb206764.aspx

    The Table says..

    olRuleActionTemplate is NOT supported when creating new rules

    programmatically.

    So what is the work around for this. Is there any code sample on this?

    Regards

    "Sue Mosher [MVP]" wrote:


    > Yes, it's possible, using the Outlook.Rule object, which is documented in
    > detail here:

    > Overview
    > http://msdn.microsoft.com/en-us/library/bb206763.aspx

    > Rule Conditions
    > http://msdn.microsoft.com/en-us/library/bb206766.aspx

    > Rule Actions including olRuleActionTemplate and olRuleActionDelete
    > http://msdn.microsoft.com/en-us/library/bb206764.aspx
    > > > Sue Mosher,
    > > >

    > "JIGNESH" wrote:
    >
    > > Outlook 2007
    > > .NET 3.5 with VS2008.
    > > In outlook manually i can create a rule which looks like below. I am looking
    > > for a code sample which can do the same. Rule is :-
    > > "Apply this rule after message arrives
    > > with "ABC" in the subject
    > > reply using "c:\users\xxxxxx...\Templates\STDReply.oft"
    > > and delete it"
    > > if via code its not possible, then I am looking for some code, which can
    > > help me to import the Rule file containing above rule.
    > > Any Directions, Clue, Code Sample/ Hit will help.
    > > Note: I had a looked at Outlook.Rule object, but I could not found my
    > > solution.
    > > Regards
    > >

Share This Page