Rules can interfere with ItemAdd, as you've seen. A server side rule
will run before the ItemAdd event on the Inbox, but client side rules
won't. They run partially before ItemAdd and partially after. So
there's plenty of room for conflict there too.
You can create a rule using code by using the Rule.DLL COM component.
You can download that from the MSDN Web site or from the Exchange 5.5
SDK. It also works in later versions of Exchange. There's some example
code for Rule.DLL at MSDN and also there's a downloadable program that
uses Rule.DLL and provides the DLL. Look at
http://www.cdolive.com/sampapps.htm and download the ruleasp.zip
example.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
"Bogdan Tarla" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I developed a plug-in for Outlook 2k/XP in Visual Basic 6.0
>
> My plug-in extract subject and body for all incoming messages. I
created a
> notification form. This form appears on the screen when new mail
arrived.
>
> I used Item_Add event for the Inbox folder
>
> Problems:
>
> 1. If the user has rules (ex. a rule who move the new messages in
other
> folder) Item_Add event doesn't always occurs.
>
> 2. If the user uses Exchange Server, Item_Add event NEVER occurs if
there
> are rules...
>
>
>
> I know there is an event in Outlook (new_mail). This event occurs
when a new
> message arrived, but this event doesn't return newMail item.
>
>
>
> I want to retrieve all new MailItem objects when a new message
arrived in
> all conditions (Exchange, Rules) on Outlook2k (Corporate and Client
Mail
> Only) and OutlookXP.
>
> Please I'm disparate, because on the Internet, I can't find any
solutions
>
>
>
> PS
>
> If this is not possible, I want to create programmatically a rule.
This rule
> will copy all new messages in a folder RetrievedNewMails (this
folder i will
> create programmatically in DeletedItems folder). Means the event
Item_Add
> (for this folder) always fire. The problem is: Is possible to create
> programmatically (in Visual Basic) rules?? If the user uses Outlook
with
> Exchange where I will create the rule programmatically? On the
server? Is
> possible?
>
>
>
> Any help would be greatly appreciated.
>
> Thanks
> Bogdan Tarla
>
> Software engineer
>
>