IMAPIContainer::OpenEntry

Send Feedback

The OpenEntry method opens an object within the container, returning 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 Values

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
    Either the user has insufficient permissions to open the object or an attempt was made to open a read-only object with read/write access.
  • MAPI_E_NOT_FOUND
    The entry identifier specified by lpEntryID does not represent an object.
  • MAPI_E_UNKNOWN_ENTRYID
    The entry identifier in the lpEntryID parameter is not of a format recognized by the container.

Remarks

OpenEntry opens 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 **lppUnk object interface *lpulObjType
message store IMsgStore Not defined
folder IMAPIFolder MAPI_FOLDER
message IMessage MAPI_MESSAGE

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

Calling OpenEntry and setting lpEntryID to point to the entry identifier of a message store is equivalent to calling the IMAPISession::OpenMsgStore method.

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 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.

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

Requirements

Pocket PC: Pocket PC 2002 and later
Smartphone: Smartphone 2002 and later
OS Versions: Windows CE 3.0 and later
Header: mapidefs.h
Library: cemapi.lib

See Also

IMAPIContainer | Messaging

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.