ID Property (Folder Object)

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

Syntax

objFolder.ID

Data Type

String

Remarks

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 Folder object and the property parameter of the RenderProperty method to CdoPR_ENTRYID.

Example

' save the current ID and restore using Session.GetFolder 
'          fragment from Session_Inbox 
    Set objFolder = objSession.Inbox 
'          fragment from Folder_FolderID 
    strFolderID = objFolder.ID 
    MsgBox "Current Folder ID = " & strFolderID 
' later: restore folder using objSession.GetFolder(strFolderID) 
'          fragment from Session_GetFolder 
    If "" = strFolderID Then 
        MsgBox ("Must first set folder ID variable; see Folder->ID") 
        Exit Function 
    End If 
    Set objFolder = objSession.GetFolder(strFolderID) 
    ' error checking here ... 
 

See Also

FolderID Property (Folder Object), GetFolder Method (Session Object), StoreID Property (Folder Object)