Microsoft KB Archive/298401

= How To Access a CDO 1.21 Entry Identifier from CDOEX =

Article ID: 298401

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft Exchange 2000 Server Standard Edition
 * Collaboration Data Objects for Exchange 2000
 * Microsoft Collaboration Data Objects 1.21

-



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 = &quot;mango5&quot; strDomainName = &quot;mango5dm.microsoft.com&quot; strUserName = &quot;Administrator&quot; strMail = &quot;Test.eml&quot; strMsgURL = &quot;file://./backofficestorage/&quot; & _ strDomainName & &quot;/MBX/&quot; & _ strUserName & &quot;/inbox/&quot; & strMail 'Open the message. Set objCDOEXMsg = CreateObject(&quot;CDO.Message&quot;) objCDOEXMsg.DataSource.Open strMsgURL 'Convert the byte array in MAPI property PR_ENTRYID to a string. strIDProp = &quot;http://schemas.microsoft.com/mapi/proptag/x0fff0102&quot; byteArray = objCDOEXMsg.Fields(strIDProp).Value For Each singleByte In byteArray byteString = Hex(singleByte) If Len(byteString) < 2 Then byteString = &quot;0&quot; & byteString End If    EntryID = EntryID & byteString Next Set objCDOEXMsg = Nothing 'Log on via CDO 1.21. Set objSession = CreateObject(&quot;MAPI.Session&quot;) objSession.Logon ProfileInfo:=strSvrName & vbLf & strUserName 'Get the message based on the message entry ID. Set objMsg = objSession.GetMessage(EntryID) MsgBox &quot;Message Subject: &quot; & 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.</ol>

Keywords: kbhowto kbmsg KB298401

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.