Message ID of an msg file

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
 

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