Why I get duplicated email items when iterate the Inbox
<p>I get some items duplicated when I iterate the Inbox of an IMAP folder looking for messages with a particular subject line and sender e-mail address. For instance, in Outlook application I can see just 3 messages passing the filter, but the following script results in 5 messages with one of the messages read 3 times. I have been checking and each duplicated element has different ConversationID even when the subject line and body text is the same. From where those duplicates are coming if I cannot see them in the Outlook panel?</p>

<p>Thanks in advance!</p>

<pre><code>Private Sub GetFromFolder(ofldr)

Dim oItem
Dim oSubFldr
Dim sBadEmail
Dim matches    
Dim colMail
Dim i
Dim key

Set colMail = CreateObject("Scripting.Dictionary")

i = 1
' Process all mail items in this folder
For Each oItem In ofldr.Items
    If TypeName(oItem) = "MailItem" Then
        With oItem
            If StrComp(.Subject, g_SubjectLine) = 0 And StrComp(.SenderEmailAddress, g_SystemEmailAddress) = 0 Then
                'ProcessQuery .Body
                colMail.Add i, oItem
                i = i + 1
            End If                
        End With
    End If
Next

For Each key In colMail.Keys        
        ProcessQuery colMail.Item(key).Body     
Next

set colMail = Nothing

End Sub
</code></pre>