There are 2 newmail events in application. I dont know exact functions in
VB. I'm using c++.
newmail(0xf003) this is call when we create a new mail in outlook
newmailex(0xfba7) this is call when a new mail receives in outlook for
following cases
1. new mail receive in inbox folder
2. we create a new mail and save/send it
3. we move a mail from one folder to another folder
For all cases outlook first calls application_newmailex then Items.ItemAdd
NewMailEx() gives you a delimited list of the EntryID's of items that have
come in since the last time that event fired.
Please explain how EntryID's can help?
The critical case is if a exchange user has some mails already in it and we
create a new profile for this user in outlook and login to outlook then
application_newmailex and Items.ItemAdd will be call for all mails which
come to inbox until outlook restored all old mails.
"Ken Slovak - [MVP - Outlook]" wrote in message
...
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.