Platform SDK: MAPI

Starting a CMC Session

CMC function calls occur within the context of a messaging session. Establish a session with a call to the cmc_logon function. The cmc_logon function checks the user's credentials for the messaging system, sets session attributes, and returns a session handle for use in later CMC calls. Session attributes include the character set and version number for the CMC API. Currently, the CMC API provides no support for sharing sessions among clients. End a session with a call to the cmc_logoff function.

You can convert the CMC session handles to MAPI session handles with the ScMAPIXFromCMC function. For example, you can convert the session handle returned from the cmc_logon function to an LPMAPISESSION value and use it to access the methods in the IMAPISession interface. This enables you to use CMC for the bulk of your messaging tasks without sacrificing access to MAPI functions. CMC session handles cannot be converted to Simple MAPI session handles. Clients that need both CMC and Simple MAPI functionality must maintain separate sessions for each.

You can also use the cmc_query_configuration function to determine logon identity and messaging options before calling the cmc_logon function.