Platform SDK: MAPI |
The session pointer that you receive from your call to MAPILogonEx can be used to access a wide variety of objects. The following table lists the methods that are used to access various objects:
Object | Session method |
---|---|
Profile section | OpenProfileSection |
Message store | OpenMsgStore |
Address book | OpenAddressBook |
Message service administration object | AdminServices |
Folder, message, address book container, distribution list, or messaging user | OpenEntry |
With the OpenEntry method and a valid entry identifier, you can open any address book or message store provider object. There are other OpenEntry methods in MAPI, in addition to the IMAPISession method. OpenEntry is implemented in the following objects:
Object | Method |
---|---|
Address book provider's logon object | IABLogon::OpenEntry |
Address book | IAddrBook::OpenEntry |
Address book container | IMAPIContainer::OpenEntry |
Session | IMAPISession::OpenEntry |
Message store | IMsgStore::OpenEntry |
Message store provider's logon object | IMSLogon::OpenEntry |
Folder | IMAPIContainer::OpenEntry |
Support object | IMAPISupport::OpenEntry |
Some OpenEntry methods require an entry identifier of the object to be opened, as does IMAPISession::OpenEntry; other methods allow NULL to be specified. A NULL entry identifier is interpreted differently depending on the object. For example, when you call IAddrBook::OpenEntry with a NULL entry identifier, MAPI opens the root container of the address book. The message store's OpenEntry method behaves similarly; it opens the root folder of the message store. IMAPIContainer::OpenEntry, implemented by both folders and address book containers, might return MAPI_E_INVALID_PARAMETER or the root container, depending on the implementer.
In addition to disallowing a NULL value for the entry identifier, the session's OpenEntry method differs from other OpenEntry methods because its job is not to open objects. Instead, it examines the entry identifier and forwards the call to another OpenEntry method implemented by the appropriate service provider. For example, if you call IMAPISession::OpenEntry with the entry identifier of a message, MAPI calls the IMSLogon::OpenEntry method of the message store responsible for the message.
In addition to using the session to open objects, clients use it to compare them. The IMAPISession::CompareEntryIDs method compares objects by comparing their entry identifiers. If the MAPIUID structures contained within the entry identifiers belong to the same service provider, MAPI forwards the call to that provider. CompareEntryIDs returns an error value when the two entry identifiers do not match. Although this method can compare entry identifiers that belong to any type of object, CompareEntryIDs works best for higher level objects such as message stores and address book containers. To compare lower level objects, compare directly the objects' search keys (PR_SEARCH_KEY) or record keys (PR_RECORD_KEY).
Like OpenEntry, CompareEntryIDs is implemented by multiple objects. Choose which OpenEntry and CompareEntryID method to use according to the amount of information that you have about the object or objects to be opened or compared. Use the following guidelines when deciding which interface method to call: