Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Galen Murdock" <GalenMurdock@discussions.microsoft.com> wrote in message
news:5DE2C609-C218-4928-A617-8914153A9326@microsoft.com...
> 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?
>
> Code:
>
> 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 =
> Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Parent.Folders(DEST_FOLDER_ROOT).Folders(ALL_FOLDER)
>
> 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
> Next
>
> ' for debug only
> ' MsgBox "Moved " & lCount & " items."
>
> GoTo HExit
> HError:
>
> MsgBox "ERROR " & Err.Number & " in " & Err.Source & ": " &
> Err.Description & vbCrLf & vbCrLf & "Debug Info:" & vbCrLf & strDebug
> Resume HExit
> HExit:
> Set newItm = Nothing
> Set curItm = Nothing
> Set myDestFolder = Nothing
> End Sub
>
> TIA!
>
> -- Galen
> ________________
> Galen Earl Murdock
> Veracity Solutions
>
>