R
Robert Haines
I have a script that will move the email from a specific person to an archive
folder.
The problem is that thg received date is reset to the date and time of when
the script is ran. Is this normal behaviour? if so is there a way around it?
Code is as follows.....
Function Quote(MyText)
Quote = Chr(34) & MyText & Chr(34)
End Function
'On Error Resume Next
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objInbox = objNamespace.GetDefaultFolder(olFolderInbox)
'Set objfolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
set objFolder = objFolder.Folders("z_archive")
'Set objFolder = objFolder.Folders("2008")
Set colItems = objInbox.Items
Set colItems = objInbox.Items
Set objItem = colItems.Find("[SenderName] = 'PersonA'")
'Set objItem = colItems.Find strSearch
Do While TypeName(objItem) <> "Nothing"
objItem.Move objFolder
Set objItem = colItems.FindNext
Loop
Eventually i'll be wanting to change the filer to a date but this code
doesnt pick up anything
strSearch = "[Start] <= " & _
Quote("January 1, 2008 00:00") & _
" AND [End] > " & _
Quote("December 31, 2008 23:59")
Set objItem = colItems.Find strSearch
Could someone advise what i'm missing please?
Thanks
folder.
The problem is that thg received date is reset to the date and time of when
the script is ran. Is this normal behaviour? if so is there a way around it?
Code is as follows.....
Function Quote(MyText)
Quote = Chr(34) & MyText & Chr(34)
End Function
'On Error Resume Next
Const olFolderInbox = 6
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objInbox = objNamespace.GetDefaultFolder(olFolderInbox)
'Set objfolder = objNamespace.GetDefaultFolder(olFolderInbox)
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
set objFolder = objFolder.Folders("z_archive")
'Set objFolder = objFolder.Folders("2008")
Set colItems = objInbox.Items
Set colItems = objInbox.Items
Set objItem = colItems.Find("[SenderName] = 'PersonA'")
'Set objItem = colItems.Find strSearch
Do While TypeName(objItem) <> "Nothing"
objItem.Move objFolder
Set objItem = colItems.FindNext
Loop
Eventually i'll be wanting to change the filer to a date but this code
doesnt pick up anything
strSearch = "[Start] <= " & _
Quote("January 1, 2008 00:00") & _
" AND [End] > " & _
Quote("December 31, 2008 23:59")
Set objItem = colItems.Find strSearch
Could someone advise what i'm missing please?
Thanks