Microsoft Knowledge Base Email Alertz

(298401) - 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...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

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:
  1. In Microsoft Visual Basic, open a new Standard EXE project.
  2. 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
    
    					
  3. Change strSvrName, strDomainName, strUserName, and strMail in the code accordingly.
  4. Make a reference to Microsoft CDO for Exchange 2000 Library and Microsoft CDO 1.21 library.
  5. Run the program and then click the button.
  6. Verify that the subject of the message is correct.

APPLIES TO
  • Microsoft Exchange 2000 Server Standard Edition
  • Collaboration Data Objects for Exchange 2000
  • Microsoft Collaboration Data Objects 1.21
Keywords: 
kbhowto kbmsg KB298401
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate