CompareIDs Method (Session Object)

CompareIDs Method (Session Object)

The CompareIDs method determines whether two CDO Library objects are the same object.


objSession.CompareIDs(ID1, ID2)


Required. The Session object.


Required. String. The unique identifier of the first object to be compared.


Required. String. The unique identifier of the second object to be compared.


The CompareIDs method compares the identifiers of two arbitrary CDO Library objects and returns True if they are the same object. Two objects are considered to be the same if and only if they are instantiations of the same physical (persistent) object in the underlying messaging system. Two objects with the same value are still considered different if they do not instantiate the same physical object, for example if one is a copy of the other. In such a case CompareIDs returns False.

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. 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. For more information on entry identifiers, see the MAPI Programmers Reference.

The CompareIDs method ultimately calls one of the MAPI CompareEntryIDs methods to determine if two objects are the same. Several CDO Library objects also provide the IsSameAs method for a comparison of two objects of that particular type.

See Also


Session Object