ID Property (Message Object)

The ID property returns the unique identifier of the Message object as a string. Read-only.



Data Type



The ID property can be used to retrieve this message at a later time, using the Session objects GetMessage method.


The Exchange Server 2003 SP2 version of CDO 1.2.1 handle calendar items differently than earlier versions of Exchange Server 2003. See Calendaring Changes in CDO 1.2.1 for more information.

MAPI assigns a permanent, unique identifier when an object is created. This identifier does not change from one MAPI session to another, nor from one messaging domain to another. However, MAPI does not require identifier values to be binary comparable. Accordingly, two identifiers can have different values, yet refer to the same object. In particular, one of them could be a short-term identifier and the other a long-term identifier; these are constructed using different formats.

MAPI compares identifiers with the CompareEntryIDs method, which takes into account the differences between identifier formats and returns True if the identifiers are assigned to the same object. CDO provides the CompareIDs method in the Session object, which furnishes the same functionality. For more information on entry identifiers, see the MAPI Programmers Reference.

The ID property is not automatically set when you create an appointment within a CDO application until you call the Update method. In this case, the application must assign a value to ID or an attempt to read it returns CdoE_NOT_FOUND.

The ID property corresponds to the MAPI property PR_ENTRYID, converted to a string of hexadecimal characters. It can be rendered into HTML hypertext using the CDO Rendering ObjectRenderer object. To specify this, set the object renderer's DataSource property to this Message object and the property parameter of the RenderProperty method to CdoPR_ENTRYID.


'     Save ID of last message accessed; use at startup
'     from the sample function Message_ID
    strMessageID = objOneMsg.ID

' ... on shutdown, save the ID to storage
' ... on startup, get the ID from storage and restore
'     from the sample function Session_GetMessage
    Set objOneMsg = objSession.GetMessage(strMessageID)

See Also


Message Object