Converting to Active Messaging 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 Active Messaging Library for other tasks. If you take advantage of both the MAPI and the Active Messaging 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, Active Messaging Library objects are accessed with hexadecimal message identifiers.

    To convert a MAPI entry identifier to an Active Messaging 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 Active Messaging Library to open the message.

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