OpenIMsgSession

The OpenIMsgSession function creates and opens a message session that groups the messages created within it.

Note This function may not be supported in future versions of MAPI.

Quick Info

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
Reserved; must be zero.
lppMsgSess
[out] Pointer to a pointer to the returned message session object.

Remarks

A message session is used by client applications and service providers that want to deal with several related MAPI IMessage 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 on OLE structured storage objects and OLE memory allocation, see the OLE Programmer's Reference.

See Also

IMessage-On-IStorage Functions