IMsgStore::OpenEntry
Published: July 16, 2012
Opens a folder or message and returns an interface pointer for further access.
HRESULT OpenEntry( ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags, ULONG FAR * lpulObjType, LPUNKNOWN FAR * lppUnk );
The IMsgStore::OpenEntry method opens a folder or message and returns a pointer to an interface that can be used for further access.
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. |
Folders and messages are automatically opened 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 permission; the permissions that you are granted depend on the message store provider, your access level, and the object. To determine the access level of the opened object, retrieve its PR_ACCESS_LEVEL (PidTagAccessLevel) property.
Although IMsgStore::OpenEntry can be used to open any folder or message, it is usually faster to use the IMAPIContainer::OpenEntry method if you have access to the parent folder of the folder or message to be opened.
Check the value returned in the lpulObjType parameter to determine whether the returned object type is what you expected. If the object type is not the expected type, 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