Hello all!
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:
What it does is loop through all items in the inbox and when it comes across a MailItem, it saves the attachments (with specific file names) to a network drive and marks the email as unread. Now, in Outlook 2002, this worked perfectly. However, now in 2003, whenever (within VBA code only) an item is marked read (.UnRead = False), the message deletes. Not just moves to the Deleted Items folder, but it is gone. This email box processes hundreds of emails every week, and having to save them manually will hurt us.
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!
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:
Code:
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!
Comment