title: Marking items read in a For Each loop leaves some marked unread
body: <p>I'm trying to mark messages, copied from within an Outlook subfolder to Inbox into a file system folder, as read.</p>
  <pre class="lang-vb prettyprint-override"><code>Sub demo1()
      Dim objNS As Outlook.NameSpace
      Dim objFolder As Outlook.MAPIFolder
      Dim path As String
      Dim i As Integer, iUnred As Integer
      Dim objUnreadItems As Object, m As Object, att As Object, Item As Object
      
      Set objNS = GetNamespace(&quot;MAPI&quot;)
      Set objFolder = objNS.Folders.Item(&quot;user@email.com&quot;) ' folders of your current account
      Set objFolder = objFolder.Folders(&quot;Inbox&quot;)
      Set objFolder = objFolder.Folders(&quot;SubFolder&quot;)
      
      Set objUnreadItems = objFolder.Items.Restrict(&quot;[UnRead] = True&quot;)
      ' Debug.Print objUnreadItems.Count
      
      If objUnreadItems.Count = 0 Then
     '     MsgBox &quot;NO objUnreadItems Email In Inbox&quot; TODO: add to logfile
      Else
      
          For Each Item In objUnreadItems
              'Debug.Print objUnreadItems.Count
              path = &quot;C:\temp\&quot; &amp; Item.Subject &amp; &quot;.msg&quot;
              Item.SaveAs path, olMSG
              'Debug.Print Item.ConversationTopic
              ' Item.unRead = False
          Next
          For Each Item In objFolder.Items.Restrict(&quot;[UnRead] = True&quot;)
              Debug.Print objUnreadItems.Count &amp; &quot;: &quot; &amp; Item.ConversationTopic
              Item.unRead = False
          Next
     End If
  End Sub
  </code></pre>
  <p>output looks like:</p>
  <p>9: FA Report for RMA# 2832844<br />
  9: FA Report for RMA# 2828196<br />
  8: FA Report for RMA# 2827687<br />
  7: FA Report for RMA# 2827667<br />
  6: FA Report for RMA# 2832909</p>
  <p>All messages show up in c:\temp but only five out of the nine messages are marked as read.</p>