Outlook not processing all incoming emails

J

John

Hi

I am using function NewMailEx as per below code to process attachments from

incoming messages. Problem is Outlook is skipping processing some of the

mail items probably when there are a number of them coming at the same time.

What is the problem and how can I fix it? Is there a more robust way to do

this? I have avoided .net add-in due to installation issues.

Thanks

Regards

Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)

Dim arr() As String

Dim i As Integer

Dim ns As Outlook.NameSpace

Dim itm As MailItem

Dim m As Outlook.MailItem

Set ns = Application.Session

arr = Split(EntryIDCollection, ",")

For i = 0 To UBound(arr)

Set itm = ns.GetItemFromID(arr(i))

If itm.Class = olMail Then

Set m = itm

For Each Atmt In m.Attachments

' Do some processing here

Next Atmt

End If

Next

Set ns = Nothing

Set itm = Nothing

Set m = Nothing

End Sub
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
It shouldn't skip anything. Why do you think it does so?

Best regards

Michael Bauer

Am Fri, 25 Sep 2009 02:47:44 +0100 schrieb John:


> Hi

> I am using function NewMailEx as per below code to process attachments


from
> incoming messages. Problem is Outlook is skipping processing some of the
> mail items probably when there are a number of them coming at the same


time.
> What is the problem and how can I fix it? Is there a more robust way to do
> this? I have avoided .net add-in due to installation issues.

> Thanks

> Regards

> Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
> Dim arr() As String
> Dim i As Integer
> Dim ns As Outlook.NameSpace
> Dim itm As MailItem
> Dim m As Outlook.MailItem

> Set ns = Application.Session
> arr = Split(EntryIDCollection, ",")

> For i = 0 To UBound(arr)
> Set itm = ns.GetItemFromID(arr(i))
> If itm.Class = olMail Then
> Set m = itm
> For Each Atmt In m.Attachments
> ' Do some processing here
> Next Atmt
> End If
> Next

> Set ns = Nothing
> Set itm = Nothing
> Set m = Nothing
> End Sub
 
J

John

Heavy load?

Regards

"Michael Bauer " <mb@mvps.org> wrote in message

news:z00ryc1ya6gf.h3qxehd5614n$.dlg@40tude.net...

> It shouldn't skip anything. Why do you think it does so?

> > Best regards
> Michael Bauer

> >

> Am Fri, 25 Sep 2009 02:47:44 +0100 schrieb John:
>
> > Hi
>

>> I am using function NewMailEx as per below code to process attachments

> from
> > incoming messages. Problem is Outlook is skipping processing some of the
> > mail items probably when there are a number of them coming at the same

> time.
> > What is the problem and how can I fix it? Is there a more robust way to
> > do
> > this? I have avoided .net add-in due to installation issues.
>

>> Thanks
>

>> Regards
>

>
>> Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
> > Dim arr() As String
> > Dim i As Integer
> > Dim ns As Outlook.NameSpace
> > Dim itm As MailItem
> > Dim m As Outlook.MailItem
>

>> Set ns = Application.Session
> > arr = Split(EntryIDCollection, ",")
>

>> For i = 0 To UBound(arr)
> > Set itm = ns.GetItemFromID(arr(i))
> > If itm.Class = olMail Then
> > Set m = itm
> > For Each Atmt In m.Attachments
> > ' Do some processing here
> > Next Atmt
> > End If
> > Next
>

>> Set ns = Nothing
> > Set itm = Nothing
> > Set m = Nothing
> > End Sub
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
I don't understand your answer. Does it really skip messages, or just

attachments? If the first, process all the items within the folder, and flag

those that are processed yet (user property); if the latter, it's due to the

code you haven't provided.

Best regards

Michael Bauer

Am Sat, 26 Sep 2009 20:12:24 +0100 schrieb John:


> Heavy load?

> Regards

> "Michael Bauer " <mb@mvps.org> wrote in message
> news:z00ryc1ya6gf.h3qxehd5614n$.dlg@40tude.net...
>

>> It shouldn't skip anything. Why do you think it does so?
>

>> > > Best regards
> > Michael Bauer
>

>> >> >
>
>> Am Fri, 25 Sep 2009 02:47:44 +0100 schrieb John:
> >
> >> Hi
> >
>>> I am using function NewMailEx as per below code to process attachments

> > from
> >> incoming messages. Problem is Outlook is skipping processing some of the
> >> mail items probably when there are a number of them coming at the same

> > time.
> >> What is the problem and how can I fix it? Is there a more robust way to
> >> do
> >> this? I have avoided .net add-in due to installation issues.
> >
>>> Thanks
> >
>>> Regards
> >
>>
>>> Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
> >> Dim arr() As String
> >> Dim i As Integer
> >> Dim ns As Outlook.NameSpace
> >> Dim itm As MailItem
> >> Dim m As Outlook.MailItem
> >
>>> Set ns = Application.Session
> >> arr = Split(EntryIDCollection, ",")
> >
>>> For i = 0 To UBound(arr)
> >> Set itm = ns.GetItemFromID(arr(i))
> >> If itm.Class = olMail Then
> >> Set m = itm
> >> For Each Atmt In m.Attachments
> >> ' Do some processing here
> >> Next Atmt
> >> End If
> >> Next
> >
>>> Set ns = Nothing
> >> Set itm = Nothing
> >> Set m = Nothing
> >> End Sub
 
Top