Strange behavior using NotesDocument.GetAttachment

Was just wondering if anyone is seeing this problem. I have some code which hasn’t changed in a VERY long time but all of a sudden is doing something strange. I’m not absolutely sure but I think it might have started after applying 8.5.1 FP5.

the code processes incoming email and extracts attachments. What’s happening is that the GetAttachment appears to be returning the first attachment over and over and not getting subsequent ones. The code is very simple:

Forall i In emailDoc.items

If i.type = Attachment Then

'Grab the attachment.

Set emb = emailDoc.GetAttachment(i.values(0))

If Not (emb Is Nothing) Then

< extract attachment and other stuff >

End If

End If

End forall

When I put in debugging code to display the file name, the same file keeps coming up despite the fact that several attachments are in the email.

I decided to change things up just a little bit and tried the following:

Dim emailDocItem As NotesItem

itemArraySize% = UBound( emailDoc.items )

For k = 0 To itemArraySize%

Set emailDocItem = emailDoc.items( k )

If emailDocItem.Type = 1084 Then '… this is an attachment

Set emb = emailDoc.GetAttachment(emailDocItem.Values(0))

If Not (emb Is Nothing) Then

< do stuff >

End If

End if

Next

But it’s acting the same. Any ideas would be appreciated.

thanks

clem

Subject: *(0) retrieves only 1 attachment