If you are getting NewMail() in cases other than when email is delivered to
the Inbox of the primary mailbox then something is very wrong.
That event only fires in that case, and only then at intervals, allowing you
to miss incoming items.
A better event to use would be either Inbox.Items.ItemAdd() or NewMailEx().
NewMailEx() gives you a delimited list of the EntryID's of items that have
come in since the last time that event fired.
ItemAdd() has a limitation common to most MAPI events where it won't fire at
all if more than 16 items come in at once.
--
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
"Ashish" wrote in message
...
Ok i think item_add event is enough to handle the case. But here there is
a problem.
When a new mail arrives application_newmail event(event number 0xfba7 in
c++) is called.And when move a mail from one folder to another folder then
also application_newmail event is called.
I'm facing the problem if a exchange user has some mails in its inbox and
i create profile for this user and login to user using outlook. Here
application_newmail event will call until it receives all mails in
inbox(outlook looks like hang until all mail receive). Is there any way to
recognize this case? Means can i set a bool which tells me that outlook
has received all mails and ready for any action now? When launch outlook
OnStartupComplete is called and return before outlook receive new mails.
Is there any other function which tells outlook is idle now.
Or can we differentiate in application_newmail event for the cases when
new mail arrive or move a mail from one folder to another.