ID Property (Message Object)

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

Syntax

objMessage.ID

Data Type

String

Remarks

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

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 identifier values can be different, yet refer to the same object. MAPI compares identifiers with the CompareEntryIDs method. CDO provides the CompareIDs method in the Session object. For more information on entry identifiers, see the MAPI Programmer's Reference.

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.

Example

'     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)