I am trying to read logged emails from another system and create new messages to place into the Journaling mailbox on Exchange 2003. The only issue I am having is getting the MSGFLAG_UNSENT removed from the PR_MESSAGE_FLAGS MAPI property even though I set it to 3 in the script. My Archive system will not read the messages from the Journal mailbox unless the message has the MSGFLAG_UNSENT removed.
Const adModeReadWrite = 3
Const adCreateNonCollection = 0
Const adTypeText = 2
FolderUrl = "http://ExchServer/Exchange/MailBox/Inbox"
Set Conn = CreateObject("ADODB.Connection")
Conn.Provider = "MSDAIPP.DSO.1"
Conn.Open FolderUrl,strUserName,strPassword,0
Set Stm = CreateObject("ADODB.Stream")
Stm.Open
stm.Type = adTypeText
stm.Charset = "US-ASCII"
'Stm.LoadFromFile "FW_ This card.eml"
'trying to get the original received date into the message
stm.writeText "Received: ; Tue, 6 Mar 2007 23:27:24 -0600",1
stm.writeText "Date: Tue, 6 Mar 2007 23:27:24 -0600",1
Set iMsg = CreateObject("CDO.Message")
iMsg.datasource.openobject stm,"_Stream"
iMsg.MimeFormatted = True
iMsg.To = "(e-mail address removed)"
iMsg.From = "(e-mail address removed)"
iMsg.Subject= "Test Message"
iMsg.TextBody = "This is the message"
iMsg.Fields("<A href="http://schemas.microsoft.com/exchange/outlookmessageclass" ).Value?>http://schemas.microsoft.com/exchange/outlookmessageclass").Value = "IPM.Note.*"
iMsg.Fields("http://schemas.microsoft.com/mapi/proptag/x0E070003").value = 3
iMsg.Fields("urn:schemas:httpmail:read") = FALSE
iMsg.Fields.Update
iMsg.DataSource.SaveToContainer FolderUrl,conn , adModeReadWrite, adCreateNonCollection
Thanks,
mniccum
Const adModeReadWrite = 3
Const adCreateNonCollection = 0
Const adTypeText = 2
FolderUrl = "http://ExchServer/Exchange/MailBox/Inbox"
Set Conn = CreateObject("ADODB.Connection")
Conn.Provider = "MSDAIPP.DSO.1"
Conn.Open FolderUrl,strUserName,strPassword,0
Set Stm = CreateObject("ADODB.Stream")
Stm.Open
stm.Type = adTypeText
stm.Charset = "US-ASCII"
'Stm.LoadFromFile "FW_ This card.eml"
'trying to get the original received date into the message
stm.writeText "Received: ; Tue, 6 Mar 2007 23:27:24 -0600",1
stm.writeText "Date: Tue, 6 Mar 2007 23:27:24 -0600",1
Set iMsg = CreateObject("CDO.Message")
iMsg.datasource.openobject stm,"_Stream"
iMsg.MimeFormatted = True
iMsg.To = "(e-mail address removed)"
iMsg.From = "(e-mail address removed)"
iMsg.Subject= "Test Message"
iMsg.TextBody = "This is the message"
iMsg.Fields("<A href="http://schemas.microsoft.com/exchange/outlookmessageclass" ).Value?>http://schemas.microsoft.com/exchange/outlookmessageclass").Value = "IPM.Note.*"
iMsg.Fields("http://schemas.microsoft.com/mapi/proptag/x0E070003").value = 3
iMsg.Fields("urn:schemas:httpmail:read") = FALSE
iMsg.Fields.Update
iMsg.DataSource.SaveToContainer FolderUrl,conn , adModeReadWrite, adCreateNonCollection
Thanks,
mniccum