Partager via


OpenIMsgSession

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 page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Creates and opens a message session that groups the messages created within it.

Header file:

Imessage.h

Implemented by:

MAPI

Called by:

Client applications and service providers

SCODE OpenIMsgSession(
  LPMALLOC lpMalloc,
  ULONG ulFlags,
  LPMSGSESS FAR * lppMsgSess
);

Parameters

  • lpMalloc
    [in] Pointer to a memory allocator object exposing the OLE IMalloc interface. MAPI needs to use this allocation method when working with the OLE IStorage interface.

  • ulFlags
    [in] Reserved; must be zero.

  • lppMsgSess
    [out] Pointer to a pointer to the returned message session object.

Return Value

  • S_OK
    The session was opened.

  • MAPI_E_INVALID_PARAMETER
    lpMalloc or lppMsgSess is NULL.

  • MAPI_E_INVALID_FLAGS
    Invalid flags were passed.

Remarks

A message session is used by client applications and service providers that want to deal with several related MAPI IMessage : IMAPIProp objects built on top of underlying OLE IStorage objects. The client or provider uses the OpenIMsgSession and CloseIMsgSession functions to wrap the creation of such messages inside a message session. Once the message session is opened, the client or provider passes a pointer to it in a call to OpenIMsgOnIStg to create a new IMessage-on-IStorage object.

A message session keeps track of all IMessage-on-IStorage objects created during the duration of the session, in addition to all the attachments and other properties of the messages. When a client or provider calls CloseIMsgSession, it closes all these objects. Calling CloseIMsgSession is the only way to close IMessage-on-IStorage objects.

OpenIMsgSession is used by clients and providers that require the ability to handle several related messages as OLE IStorage objects. If only one such message is to be open at a time, there is no need to track multiple messages and no reason to create a message session with OpenIMsgSession.

Because it is dealing with an underlying OLE object, MAPI needs to use OLE memory allocation. For more information about OLE structured storage objects and OLE memory allocation, see OLE and Data Transfer.