IMAPISession::OpenEntry
Published: July 16, 2012
Opens an object and returns an interface pointer for additional access.
HRESULT OpenEntry( ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags, ULONG FAR * lpulObjType, LPUNKNOWN FAR * lppUnk );
Important
|
|---|
|
When opening folder entries on a public store, such as folders and messages, use IMsgStore::OpenEntry instead of IMAPISession::OpenEntry. This ensures that public folders function correctly when multiple Exchange accounts are defined in a profile. |
Call IMAPISession::OpenEntry only when you do not know what kind of object that you are opening. If you know that you are opening a folder or a message, call IMsgStore::OpenEntry. If you know that you are opening an address book container, a messaging user, or a distribution list, call IAddrBook::OpenEntry. These more specific methods are faster than IMAPISession::OpenEntry.
MAPI opens all objects with read-only permission, unless you set the MAPI_MODIFY or MAPI_BEST_ACCESS flag in the ulFlags parameter. Setting one of these flags does not guarantee a particular type of access; the permissions that are granted depend on the service provider, the access level, and the object. To determine the access level of the opened object, retrieve its PR_ACCESS_LEVEL (PidTagAccessLevel) property.
Calling IMAPISession::OpenEntry and setting lpEntryID to point to the entry identifier of a message store is the same as calling the IMAPISession::OpenMsgStore method with the MDB_NO_DIALOG flag set. The flag settings are also equivalent, except that to request read/write permission with OpenMsgStore, you must set the MDB_WRITE flag instead of MAPI_MODIFY.
Check the value returned in the lpulObjType parameter to determine whether the object type returned is what you expected. If the object type is not the type that you expected, cast the pointer from the lppUnk parameter to a pointer of the appropriate type. For example, if you are opening a folder, cast lppUnk to a pointer of type LPMAPIFOLDER.
Important