Opening an Object in the Directory

If you know the distinguished name (DN) of an object in the directory, you can open that object using the HrCreateDirEntryIdEx function. For more information on DNs, see Microsoft Exchange Server Addresses.

    To open a directory object
  1. Start a MAPI session. For information on how to do this, see the first two steps of Opening an Information Store.
  2. Open a the address book by calling the IMAPISession::OpenAddressBook method.
  3. Obtain an entry identifier for the object by calling the HrCreateDirEntryIdEx function, passing a pointer to the address book (returned in step 2) and the DN of the object.
  4. Call the OpenEntry function, passing the entry identifier for the object.