ApplicationEvents_11_Event.NewMailEx Event
Occurs when a new item is received in the Inbox.
Namespace: Microsoft.Office.Interop.Outlook
Assembly: Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)
Syntax
'Declaration
Event NewMailEx As ApplicationEvents_11_NewMailExEventHandler
'Usage
Dim instance As ApplicationEvents_11_Event
Dim handler As ApplicationEvents_11_NewMailExEventHandler
AddHandler instance.NewMailEx, handler
event ApplicationEvents_11_NewMailExEventHandler NewMailEx
Remarks
This event fires once for every received item that is processed by Outlook. The item can be one of several different item types, for example, MailItem, MeetingItem, or SharingItem. The EntryIDsCollection string contains the Entry ID that corresponds to that item. Note that this behavior has changed from earlier versions of the event when the EntryIDCollection contained a list of comma-delimited Entry IDs of all the items received in the Inbox since the last time the event was fired.
This event fires for e-mail accounts that provide notifications for received messages, such as Microsoft Exchange Server and POP3 accounts.
The NewMailEx event fires when a new message arrives in the Inbox and before client rule processing occurs. You can use the Entry ID returned in the EntryIDCollection array to call the GetItemFromID method and process the item. Use this method with caution to minimize the impact on Outlook performance. However, depending on the setup on the client computer, after a new message arrives in the Inbox, processes like spam filtering and client rules that move the new message from the Inbox to another folder can occur asynchronously. You should not assume that after these events fire, you will always get a one-item increase in the number of items in the Inbox.
For users with an Exchange Server account (non-Cached Exchange Mode or Cached Exchange Mode), the event fires only for messages that arrive at the server after Outlook has started. The event does not fire for messages that are synchronized in Cached Exchange Mode immediately after Outlook starts, or for messages that are already on the server when Outlook starts in non-Cached Exchange Mode.
For users using Cached Exchange Mode, the event fires in all settings provided that Outlook is running when the message is received: Download Full Items, Download Headers, and Download Headers and then Full Items.
See Also
Reference
ApplicationEvents_11_Event Interface
ApplicationEvents_11_Event Members
Microsoft.Office.Interop.Outlook Namespace
Microsoft.Office.Interop.Outlook.ApplicationEvents_11_NewMailExEventHandler