Article ID: 298401 - Last Review: February 22, 2007 - Revision: 2.5
How To Access a CDO 1.21 Entry Identifier from CDOEX
This article was previously published under Q298401
SUMMARY
The PR_ENTRYID property contains a MAPI entry identifier that is used to identify a particular MAPI object. This article demonstrates how to get the entry identifier of a message using Collaboration Data Objects for Exchange (CDOEX) and then use this identifier to open the message using CDO 1.21.
MORE INFORMATION
To run the sample code, follow these steps:
- In Microsoft Visual Basic, open a new Standard EXE project.
- Add a button to the default form and paste the following code in the button click event:
Dim objCDOEXMsg As CDO.Message Dim strSvrName As String Dim strDomainName As String Dim strUserName As String Dim strMail As String Dim strMsgURL As String Dim byteArray As Variant Dim singleByte As Variant Dim byteString As String Dim EntryID As String Dim strIDProp As String Dim objSession As MAPI.Session Dim objMsg As MAPI.Message strSvrName = "mango5" strDomainName = "mango5dm.microsoft.com" strUserName = "Administrator" strMail = "Test.eml" strMsgURL = "file://./backofficestorage/" & _ strDomainName & "/MBX/" & _ strUserName & "/inbox/" & strMail 'Open the message. Set objCDOEXMsg = CreateObject("CDO.Message") objCDOEXMsg.DataSource.Open strMsgURL 'Convert the byte array in MAPI property PR_ENTRYID to a string. strIDProp = "http://schemas.microsoft.com/mapi/proptag/x0fff0102" byteArray = objCDOEXMsg.Fields(strIDProp).Value For Each singleByte In byteArray byteString = Hex(singleByte) If Len(byteString) < 2 Then byteString = "0" & byteString End If EntryID = EntryID & byteString Next Set objCDOEXMsg = Nothing 'Log on via CDO 1.21. Set objSession = CreateObject("MAPI.Session") objSession.Logon ProfileInfo:=strSvrName & vbLf & strUserName 'Get the message based on the message entry ID. Set objMsg = objSession.GetMessage(EntryID) MsgBox "Message Subject: " & objMsg.Subject objSession.Logoff Set objSession = Nothing Set objMsg = Nothing - Change strSvrName, strDomainName, strUserName, and strMail in the code accordingly.
- Make a reference to Microsoft CDO for Exchange 2000 Library and Microsoft CDO 1.21 library.
- Run the program and then click the button.
- Verify that the subject of the message is correct.
Note: This article is from Microsoft Knowledage Base
Related problems posted by other users | |
| more... |

