Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
4/8/2010

The OpenEntrymethod opens a message store object and returns an interface pointer for further access.

Syntax

HRESULT OpenEntry (
  ULONG 
cbEntryID,
  LPENTRYID 
lpEntryID,
  LPCIID 
lpInterface,
  ULONG 
ulFlags,
  ULONG FAR * 
lpulObjType,
  LPUNKNOWN FAR * 
lppUnk
);

Parameters

cbEntryID

[in] Count of bytes in the entry identifier pointed to by lpEntryID.

lpEntryID

[in] Reference to the entry identifier of the object to open; cannot be NULL.

lpInterface

[in] Ignored.

ulFlags

[in] Ignored.

lpulObjType

[out] Reference to the type of the opened object.

lppUnk

[out] Reference to the opened object.

Return Value

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:

S_OK

Indicates success.

MAPI_E_NO_ACCESS

An attempt was made to modify a read-only object or to access an object for which the user has insufficient permissions.

Remarks

OpenEntryopens a message store object, folder object, or message object, and returns a pointer that can be used to access the object, described in the following table:

Opened object **lppUnkobject interface *lpulObjType

message store

IMsgStore

Not defined

folder

IMAPIFolder

MAPI_FOLDER

message

IMessage

MAPI_MESSAGE

All MAPI OpenEntrymethods call down to the same underlying helper function, so there's no performance hit in choosing IMsgStore::OpenEntryover IMAPISession::OpenEntryor IMAPIFolder::OpenEntry(which is accessible through IMAPIContainer::OpenEntry).

Calling OpenEntryand setting lpEntryIDto point to the entry identifier of a message store is equivalent to calling the IMAPISession::OpenMsgStoremethod.

Check the value returned in the lpulObjTypeparameter to determine whether the object type returned is what you expected. If the object type is not the expected type, cast the pointer from the lppUnkparameter to a pointer of the appropriate type. For example, if you are opening a folder, cast lppUnkto a pointer of type LPMAPIFOLDER.

When you are done using the object referenced by lppUnk, you must free its memory by calling its Releasemethod.

Requirements

Header mapidefs.h
Library cemapi.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Pocket PC 2002 and later, Smartphone 2002 and later

See Also