Share via


IMAPISession::OpenEntry (Compact 7)

3/12/2014

This method opens an IMsgStore object, an IFolder object, or an IMessage object and returns a pointer that can be used to access the object.

Syntax

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

Parameters

Parameter Description

cbEntryID

[in] Count of bytes in the entry identifier that lpEntryID points to.

lpEntryID

[in] Pointer to the entry identifier of the object to open. Cannot be NULL.

lpInterface

[in] Ignored.

ulFlags

[in] Ignored.

lpulObjType

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

lppUnk

[out] Pointer to the opened object.

Return Value

The following table shows the possible return values.

Value Description

S_OK

The method succeeded.

MAPI_E_NOT_FOUND

No object associated with the entry identifier was passed in the lpEntryID parameter.

MAPI_E_UNKNOWN_ENTRYID

The entry identifier passed in the lpEntryID parameter is in an unrecognizable format. This value is typically returned if the MAPI service provider that contains the object is not open.

E_FAIL

The method failed due to an unspecified error.

E_INVALIDARG

The method failed because one or more of the arguments is not valid.

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 when you use IMAPISession::OpenEntry instead of IMsgStore::OpenEntry or IMAPIFolder::OpenEntry (which is accessible through IMAPIContainer::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 that lppUnk references, you must free the memory that the object uses by calling its Release method.

Requirements

Header

mapix.h

Library

cemapi.lib

See Also

Reference

IMAPISession