How exactly do you call that code? Are you setting the properties using
SafeMailItem.Fields or RDOMail.Fields?
In the former case the item is still saved by Outlook; and it might
overwrite the value set using Redemption when MailItem.Save is called.
The following script will create a sent item in the Inbox and set the Sender
and ReceivedTime properties using the RDO family of objects (which does not
depend on Outlook Object Model in any way):
set Session = CreateObject("Redemption.RDOSession")
'Session.Logon - if you do not use the line below
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set NewMsg =
Session.GetDefaultFolder(olFolderInbox).Items.Add("IPM.Note")
NewMsg.Sent = true
NewMsg.Subject = "fake sent item"
NewMsg.Body = "test body"
set Recip = NewMsg.Recipients.Add("(e-mail address removed)")
Recip.Resolve
NewMsg.Sender = Session.CurrentUser
NewMsg.SentOnBehalfOf = Session.CurrentUser
NewMsg.SentOn = Now
NewMsg.ReceivedTime = Now
NewMsg.Save
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool