I'm having a strange issue happen from a recent upgrade from Outlook 2002 to 2003. Here is a dumbed down version of the main loop I'm using to debug the problem:
Expand|Select|Wrap|Line Numbers
- Dim app As Outlook.Application
- Dim ns As Outlook.namespace
- Dim inbox As Outlook.mapifolder
- Dim item As Object
- Dim msg As Outlook.mailitem
- Dim rpt As Outlook.reportitem
- Set app = GetObject(, "Outlook.Application")
- Set ns = app.session
- ns.logon
- Set inbox = ns.getdefaultfolder(olfolderinbox)
- Debug.Print "inbox items: " & inbox.Items.Count
- For Each item In inbox.Items
- Select Case TypeName(item)
- Case "ReportItem"
- Set rpt = item
- Debug.Print "ReportItem: " & rpt.Subject
- Case "MeetingItem"
- Debug.Print "MeetingItem"
- Case "MailItem"
- Set msg = item
- Debug.Print "MailItem: " & msg.Subject
- 'go off any handle the mail item
- 'through subcode
- msg.UnRead = false '*************************** Issue here!!
- Case Else
- Debug.Print "We don't care about this type"
- End Select
- Next item
Is anyone aware of this issue, or any way to work around this? The reason we mark it as read is so that we know which items were processed by the program, and which items will need manual intervention.
Any help would be appreciated!