![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
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 ThisOutlookSession.Session.Stores.Item(pstNameCont ainingMainInbox).GetRootFolder * starting from GetNamespace("MAPI").Stores.Item(pstNameContaining MainInbox).GetRootFolder etc. Bug? Feature? Heh... Thanks! Galen __________________ Galen Earl Murdock Veracity Solutions "Dmitry Streblechenko" wrote: 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) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "Galen Murdock" wrote in message ... 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).Fo lders(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 |
#2
|
|||
|
|||
![]()
You can't this is just what Outlook Object Model does.
Extended MAPI (and Redemption) do not have this bug. -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "Galen Murdock" wrote in message ... 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 ThisOutlookSession.Session.Stores.Item(pstNameCont ainingMainInbox).GetRootFolder * starting from GetNamespace("MAPI").Stores.Item(pstNameContaining MainInbox).GetRootFolder etc. Bug? Feature? Heh... Thanks! Galen __________________ Galen Earl Murdock Veracity Solutions "Dmitry Streblechenko" wrote: 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) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "Galen Murdock" wrote in message ... 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).Fo lders(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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Item.ReceivedTime issues/possible work around? | [email protected] | Outlook and VBA | 4 | October 2nd 07 05:11 PM |
Move email to folder based on ReceivedTime | [email protected] | Outlook and VBA | 1 | July 18th 07 07:59 AM |
Outlook macro abends but Word macro runs successfully | Jreue | Outlook and VBA | 0 | December 13th 06 11:55 PM |
Call macro stored in Excel workbook from Outlook's macro | Gvaram | Outlook and VBA | 5 | October 4th 06 06:26 AM |
how to get mail's receivedTime? | StupidDog | Outlook and VBA | 1 | April 13th 06 04:04 PM |