A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

NewMailEx Only provides First e-mail in inbox



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 2nd 09, 04:16 PM posted to microsoft.public.outlook.program_vba
ben
external usenet poster
 
Posts: 4
Default NewMailEx Only provides First e-mail in inbox

When using NewMailEx to get a list of received e-mails, EntryIDCollection
will only return the very first e-mail received, even if 10-15 e-mails come
in at the same time.

This is my code in it's entirety.


Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim arr() As String
Dim i As Integer
Dim m As MailItem
On Error Resume Next
arr = Split(EntryIDCollection, ",")
For i = 0 To UBound(arr)
Set m = Application.Session.GetItemFromID(arr(i))
MsgBox m.Subject
Next
End Sub


Or am I going at this backwards, does (Will return a list of all e-mails
that have arrived since this event last fired) mean that if I receive 5
e-mails, the first one will trigger.. but the next time I receive an e-mail
the previous 4 , plus the one just in will trigger? And if so, won't that
leave a few e-mails always in limbo?

--
When you lose your mind, you free your life.

  #2  
Old October 2nd 09, 05:30 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default NewMailEx Only provides First e-mail in inbox

Don't use a MsgBox to test any kind of automatic processing, because it's
modal and will stop execution while the box is displayed. Use Debug.Print
instead.

If you're working with an Exchange account in cached mode, NewMailEx will
fire for every single item received, so you'll see only one entry ID each
time. In online mode, it will return multiple items, but may skip a small
number under extremely heavy loads.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"ben" (remove this if mailing direct) wrote in
message ...
When using NewMailEx to get a list of received e-mails, EntryIDCollection
will only return the very first e-mail received, even if 10-15 e-mails
come
in at the same time.

This is my code in it's entirety.


Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim arr() As String
Dim i As Integer
Dim m As MailItem
On Error Resume Next
arr = Split(EntryIDCollection, ",")
For i = 0 To UBound(arr)
Set m = Application.Session.GetItemFromID(arr(i))
MsgBox m.Subject
Next
End Sub


Or am I going at this backwards, does (Will return a list of all e-mails
that have arrived since this event last fired) mean that if I receive 5
e-mails, the first one will trigger.. but the next time I receive an
e-mail
the previous 4 , plus the one just in will trigger? And if so, won't that
leave a few e-mails always in limbo?



  #3  
Old October 2nd 09, 07:45 PM posted to microsoft.public.outlook.program_vba
ben
external usenet poster
 
Posts: 4
Default NewMailEx Only provides First e-mail in inbox

Sue,

Thank you, that was precisely the problem. Changed my code to mark all
incoming messages as read for testing, and worked like a charm. I was a
little lost because all the examples I found used MsgBox for testing.


--
When you lose your mind, you free your life.



"Sue Mosher [MVP]" wrote:

Don't use a MsgBox to test any kind of automatic processing, because it's
modal and will stop execution while the box is displayed. Use Debug.Print
instead.

If you're working with an Exchange account in cached mode, NewMailEx will
fire for every single item received, so you'll see only one entry ID each
time. In online mode, it will return multiple items, but may skip a small
number under extremely heavy loads.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"ben" (remove this if mailing direct) wrote in
message ...
When using NewMailEx to get a list of received e-mails, EntryIDCollection
will only return the very first e-mail received, even if 10-15 e-mails
come
in at the same time.

This is my code in it's entirety.


Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim arr() As String
Dim i As Integer
Dim m As MailItem
On Error Resume Next
arr = Split(EntryIDCollection, ",")
For i = 0 To UBound(arr)
Set m = Application.Session.GetItemFromID(arr(i))
MsgBox m.Subject
Next
End Sub


Or am I going at this backwards, does (Will return a list of all e-mails
that have arrived since this event last fired) mean that if I receive 5
e-mails, the first one will trigger.. but the next time I receive an
e-mail
the previous 4 , plus the one just in will trigger? And if so, won't that
leave a few e-mails always in limbo?




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The EntryID in NewMailEx Event Al_21_11[_2_] Add-ins for Outlook 1 July 2nd 09 02:07 PM
Problem using NewMailEx Trefor Outlook and VBA 10 May 30th 08 03:41 PM
NewMailEx Code runs only once... Rafael[_2_] Outlook - Using Forms 0 September 9th 07 03:10 AM
Sending mail from NewMailEx deletes the mail from the Inbox Ron Outlook and VBA 1 January 10th 07 07:40 PM
NewMailEx vs. ItemAdd Mark Rae Outlook and VBA 14 June 15th 06 03:07 PM


All times are GMT +1. The time now is 12:25 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.