Expected behauvior when modifying properties? Outlook 2003.

A

Alberto

Hello, Outlook surprises me every day more or maybe I have a lack on VBA,
please read the next case and tell me if you understand something

Using Outlook 2003 SP3
langauge: German

Sub1()
' Working on MapiFolderA:
Dim myItem, myNewItem as mailItem

Set myItem= MapiFolderA.items("Item Subject")
Set myNewItem= myItem.Copy
myNewItem.subject="MyNewItem Subject"
myNewItem.save
End sub


At this point we have two items in the folder but myNewItem has the current
time as the value for the ReceivedTime property.
If i would'nt have modified MyNeWItem (.save), the ReceivedTime property
would keep its original value, but of course i want to modify the recently
created item.


Trick!!! To copy temporary the item to another folder.
NO, it doesn't work either: !!!!


Sub1()
' Working on MapiFolderA:
Dim myItem, myNewItem, myItem3 as mailItem

Set myItem= MapiFolderA.items("Item Subject")
Set myNewItem= myItem.Copy
Set MapiFolderB = GetFolder("here Path to Folder B")
Set myItem3 = MyNewItem.Move(MapiFolderB)
myItem3.Subject = "MyItem3 Subject"
myItem3.save
End sub

MyItem3 in the folder MapiFolderB has again the current time/date as the
ReceivedTime property :((

SOLUTION: (Not brilliant but at least work)
Modify the item in the new folder trough another Sub()

Sub1()
' Working on MapiFolderA:
Dim myItem, myNewItem as mailItem

Set myItem= MapiFolderA.items("Item Subject")
Set myNewItem= myItem.Copy
Set MapiFolderB = GetFolder("here Path to Folder B")
Set myItem3 = MyNewItem.Move(MapiFolderB)

Call Sub2
End sub


'In Sub2 we can modify all propertys of the item and then move it to
MapifolderA, for example.

Is this behaviour expected??
I've heard that with Redemption or CDO this behaviour is not expected but in
my environment Redemption is not an option.


Thanks in advance...
 
D

Dmitry Streblechenko

Yes, Outlook has an annoying habit of modifying ReceivedTime everytime an
item is saved.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
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

Top