Share via


IMAPIContainer::OpenEntry (Compact 7)

3/12/2014

This 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 that lpEntryID points to.
  • lpEntryID
    [in] Pointer to a reference to the entry identifier of the object to open; cannot be NULL.
  • lpInterface
    [in] Ignored.
  • ulFlags
    [in] Ignored.
  • lpulObjType
    [out] Pointer to a reference to the type of the opened object.
  • lppUnk
    [out] Pointer to a reference to the opened object.

Return Value

The following table shows the possible values.

  • S_OK
    The method succeeded.
  • MAPI_E_NOT_FOUND
    The entry identifier that lpEntryID specifies does not represent an object.
  • MAPI_E_UNKNOWN_ENTRYID
    The format of the entry identifier in the lpEntryID parameter is not recognized by the container.
  • E_FAIL
    The method failed due to an unspecified error.
  • E_INVALIDARG
    The method failed because one or more of the arguments is invalid.
  • E_OUTOFMEMORY
    The method failed because it needs more memory resources.
  • E_UNEXPECTED
    The method failed due to an unexpected error.

Remarks

The OpenEntry methods open a message store object, folder object, or message object and return a pointer that can be used to access the object, as 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 the same underlying helper function, so there is no performance change if you use IMAPIFolder::OpenEntry (which is accessible through IMAPIContainer::OpenEntry) instead of IMAPISession::OpenEntry or IMsgStore::OpenEntry.

Calling the OpenEntry method 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 the memory that the object uses by calling its Release method.

Requirements

Header

mapidefs.h

Library

cemapi.lib

See Also

Reference

IMAPIContainer