J
Julian Uebergang
Hi,
When I double click an msg file and go, file -> properties, there are two
tabs, General and Message ID. How do I get the Message ID value?
I have tried the code below which always returns the same Message ID for
each email. The problem, I think, is that CDO thinks that the email hasn't
been sent yet. Is there any way I can get the Message ID value contained
under file -> properties of an msg file?
olMailItem = olApp.CreateItemFromTemplate(sMsgFile)
olMailItem.Save()
sImageList(5, iCount) = GetInternetHeader(olMailItem)
olMailItem.Close(Outlook.OlInspectorClose.olDiscard)
Function GetInternetHeader(ByVal oMsg As Outlook.MailItem) As String
Dim objCDO As MAPI.Session
Dim objMsg As MAPI.Message
Dim oFields As MAPI.Fields
Dim oField As MAPI.Field
Dim iCount As Integer
objCDO = CreateObject("MAPI.Session")
objCDO.Logon("", "", False, False)
objMsg = objCDO.GetMessage(oMsg.EntryID)
GetInternetHeader =
objMsg.Fields(MAPI.CdoPropTags.CdoPR_TRANSPORT_MESSAGE_HEADERS)
objMsg.Delete()
objCDO.Logoff()
End Function
When I double click an msg file and go, file -> properties, there are two
tabs, General and Message ID. How do I get the Message ID value?
I have tried the code below which always returns the same Message ID for
each email. The problem, I think, is that CDO thinks that the email hasn't
been sent yet. Is there any way I can get the Message ID value contained
under file -> properties of an msg file?
olMailItem = olApp.CreateItemFromTemplate(sMsgFile)
olMailItem.Save()
sImageList(5, iCount) = GetInternetHeader(olMailItem)
olMailItem.Close(Outlook.OlInspectorClose.olDiscard)
Function GetInternetHeader(ByVal oMsg As Outlook.MailItem) As String
Dim objCDO As MAPI.Session
Dim objMsg As MAPI.Message
Dim oFields As MAPI.Fields
Dim oField As MAPI.Field
Dim iCount As Integer
objCDO = CreateObject("MAPI.Session")
objCDO.Logon("", "", False, False)
objMsg = objCDO.GetMessage(oMsg.EntryID)
GetInternetHeader =
objMsg.Fields(MAPI.CdoPropTags.CdoPR_TRANSPORT_MESSAGE_HEADERS)
objMsg.Delete()
objCDO.Logoff()
End Function