moving new messages to a folder

  • Thread starter Thread starter Kumar
  • Start date Start date
K

Kumar

Hello All,

I am trying to move New mail messages to a folder when they arrive in
inbox by using event sink ItemsEvent::ItemAdd method. The sink is
firing whenever a message is added to inbox folder but there are some
problems,

1. MailItem->Move method is giving access violation error in ItemAdd
method.
(I think it is because the message is not yet saved in inbox)

2. The event is firing even if the mail is moved from another folder
to inbox i.e. for old messages also, this should be avoided.

Is there any other way to move messages when they arrive in inbox? Is
it possible by using Application::NewMail event?

Please help

Kumar
 
Kumar said:
Hello All,

I am trying to move New mail messages to a folder when they arrive in
inbox by using event sink ItemsEvent::ItemAdd method. The sink is
firing whenever a message is added to inbox folder but there are some
problems,

1. MailItem->Move method is giving access violation error in ItemAdd
method.
(I think it is because the message is not yet saved in inbox)

2. The event is firing even if the mail is moved from another folder
to inbox i.e. for old messages also, this should be avoided.

Is there any other way to move messages when they arrive in inbox? Is
it possible by using Application::NewMail event?

Please help

Kumar

Why not just set up a Rule?
 
Why not just set up a Rule?

Thanks for your reply,

Actually it is a spam control utility, moving spam mails to a folder
either by adding a rule or by an Add-in. The method should be
initiated programmatically without any user's modifications to outlook
program, because the utility can be used in many systems.

First I tried adding a rule in outlook programmatically, which is
possible only in exchange clients, not in standalone Outlook so I
tried COM Add-in.

Kumar
 
Back
Top