Macro changes ReceivedTime when it shouldn't


Galen Murdock

Hello --

History: I've got a macro to move selected emails to another folder. It's
been working fine in Outlook for a long time (local .pst's, remote POP3/SMTP
servers). We recently installed Exchange 2007, and I created a new,
Exchange-based profile and imported my old macros. I use this macro for
personal productivity -- to quickly move selected items out of the inbox into
a history folder.

Question/Problem: Now that I'm running against Exchange, the macro changes
the received date/time of the item to the current date/time. So I can't use
my macro without it actually changing the receive dates of the emails I use
it on. To be more specific, in the code below, the "Check 2:" line always
shows the date/time on which the line above it was executed, not the original
received time. Anyone know how to move an item programmatically without
changing anything about the item?


Public Sub MoveSelectedEmailsToAllFolder_Exchange3()
On Error GoTo HError

Const DEST_FOLDER_ROOT As String = "Cache"
Const ALL_FOLDER As String = "All"

Dim myDestFolder As Folder
Set myDestFolder =

Dim strDebug As String
strDebug = vbNullString

Dim lCount As Long
lCount = 0

Dim curItm As Object
Dim newItm As Object
For Each curItm In Application.ActiveExplorer.Selection
MsgBox "Check 1: curItm.ReceivedTime=" & Format(curItm.ReceivedTime)
Set newItm = curItm.Move(myDestFolder)
MsgBox "Check 2: newItm.ReceivedTime=" & Format(newItm.ReceivedTime)
lCount = lCount + 1

' for debug only
' MsgBox "Moved " & lCount & " items."

GoTo HExit

MsgBox "ERROR " & Err.Number & " in " & Err.Source & ": " &
Err.Description & vbCrLf & vbCrLf & "Debug Info:" & vbCrLf & strDebug
Resume HExit
Set newItm = Nothing
Set curItm = Nothing
Set myDestFolder = Nothing
End Sub


-- Galen
Galen Earl Murdock
Veracity Solutions

Dmitry Streblechenko

This is an OOM bug (or feature): RecievedTime time changes when you move
messages between stores or when you modify them and call Save.

Dmitry Streblechenko (MVP)
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Galen Murdock

Hmm, but I'm not moving it between stores -- just trying to move it to the
child of a peer folder. How do I move it programmatically without causing
the framework to think it's been changed? Supposing this to be an issue,
I've already tried all kinds of ways of referencing the folder, such as:

* starting from ThisOutlookSession.ActiveExplorer.CurrentFolder
* starting from Application (example in the code below)
* starting from
* starting from


Bug? Feature? Heh...


Galen Earl Murdock
Veracity Solutions

Dmitry Streblechenko

You can't this is just what Outlook Object Model does.
Extended MAPI (and Redemption) do not have this bug.

Dmitry Streblechenko (MVP)
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question