Platform SDK: MAPI

Converting to CDO Library Identifiers

Some clients use multiple client interfaces to take advantage of what more than one client API has to offer. Typically, these clients use MAPI for some tasks and a simpler API such as the Collaboration Data Objects (CDO) Library for other tasks. If you take advantage of both the MAPI and the CDO Library client interfaces, you will need to convert between the two types of identifiers that are used for opening objects. Whereas MAPI objects are accessed with binary entry identifiers, CDO Library objects are accessed with hexadecimal message identifiers.

To convert a MAPI entry identifier to a CDO Library message identifier

  1. Call the message's IMAPIProp::GetProps method to retrieve its PR_ENTRYID property.
  2. Call HexFromBin to convert the entry identifier to a hexadecimal string or use client code to perform the conversion.
  3. Call the Win32 function SysAllocString, if necessary, to make the string compatible with Visual Basic.
  4. Make the hexadecimal string available to the Visual Basic application.
  5. Use the Session.GetMessage method in the CDO Library to open the message.

To reverse the process — converting a CDO Library message identifier to a MAPI entry identifier — call FBinFromHex. FBinFromHex converts a hexadecimal string to binary data.