Message ID of an msg file

  • Thread starter Julian Uebergang
  • Start date
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
 
W

Wei-Dong Xu [MSFT]

Hi Julian,

Thank you for posting in MSDN managed newsgroup!

So far as I know, this is by design. If the mail message hasn't been delivered by Exchange Server, the msg file will not contain the "Message ID".

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Wei-Dong Xu [MSFT]

Hi Julian,

Furthermore, you may obtain more information regarding this property from the exchange SDK. Please go to:
message-id Field(Exchange 2000)
http://msdn.microsoft.com/library/d...wss/wss/_cdo_schema_mailheader_message-id.asp

message-id Field(Exchange 2003)
http://msdn.microsoft.com/library/d...k3/e2k3/_cdo_schema_mailheader_message-id.asp

Please feel free to let me know if you have any further questions.

Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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