M
Maike13 via OfficeKB.com
I'm using Outlook 2002 SP2 and I'm pretty new to VBA so excuse me if this is an elementary question. I hope someone can help with this small but annoying problem.
When I use code to move an e-mail message from the Inbox to a folder in the Inbox, and the sender has requested a Read Receipt, the code causes a "Your message To: .... was deleted without being read on ...." message to be returned to the sender.
Is this normal? Is there a way around it? (see sample code below)
thanks
Mike
Here's some very simple sample code that illustrates the problem. I empty my Inbox, send myself a message with the "For all messages I send, request Read Receipt" option enabled. Then I run the code and it generates the "Your message To: .... was deleted without being read on ...." receipt. The moved message still displays as Unread (is bold), but doesn't generate a Read receipt when I open it.
Private Sub simpleMove()
'This sub moves the first item in the Inbox to a folder
'in the Inbox called "TEST". If "TEST" doesn't already
'exist, it's created
Dim myMsg As MailItem
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myMsg = myInbox.Items(1)
On Error Resume Next
Set mySubFolder = myInbox.Folders.Add("TEST")
Set mySubFolder = myInbox.Folders("TEST")
myMsg.Move (mySubFolder)
End Sub
PS. I know this simple move can be done with a rule, but the actual code I'm writing is more involved and can't be handled using rules.
When I use code to move an e-mail message from the Inbox to a folder in the Inbox, and the sender has requested a Read Receipt, the code causes a "Your message To: .... was deleted without being read on ...." message to be returned to the sender.
Is this normal? Is there a way around it? (see sample code below)
thanks
Mike
Here's some very simple sample code that illustrates the problem. I empty my Inbox, send myself a message with the "For all messages I send, request Read Receipt" option enabled. Then I run the code and it generates the "Your message To: .... was deleted without being read on ...." receipt. The moved message still displays as Unread (is bold), but doesn't generate a Read receipt when I open it.
Private Sub simpleMove()
'This sub moves the first item in the Inbox to a folder
'in the Inbox called "TEST". If "TEST" doesn't already
'exist, it's created
Dim myMsg As MailItem
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myMsg = myInbox.Items(1)
On Error Resume Next
Set mySubFolder = myInbox.Folders.Add("TEST")
Set mySubFolder = myInbox.Folders("TEST")
myMsg.Move (mySubFolder)
End Sub
PS. I know this simple move can be done with a rule, but the actual code I'm writing is more involved and can't be handled using rules.