libmapipp::session Class Reference

This class represents a MAPI session with the Exchange Server. More...

#include <session.h>

List of all members.

Public Member Functions

mapi_session * get_mapi_session () throw ()
 The underlying mapi_session.
TALLOC_CTX * get_memory_ctx () throw ()
 Obtain a talloc memory context for this session.
message_storeget_message_store () throw ()
 Obtain a reference to the message_store associated with this session.
std::string get_profile_name () const
 The name of the profile that is in use.
void login (const std::string &profile_name="", const std::string &password="") throw (mapi_exception)
 Log-in to the Exchange Server.
 session (const std::string &profiledb="", const bool debug=false) throw (std::runtime_error, mapi_exception)
 Constructor.
 ~session ()
 Uninitialize and clean up the MAPI session.

Static Public Member Functions

static std::string get_default_profile_path ()
 The path to the default profile database.

Detailed Description

This class represents a MAPI session with the Exchange Server.

The session is best thought of as the connection by a single user to a single server. It is possible to have multiple sessions open at the same time.

A key concept in the session is that of a profile, and the profile database. The profile is a pre-established data set that specifies the server information (e.g. server name / IP address, and Exchange domain) and client information (e.g. the user name, preferred language, and optionally the users password). The profiles are stored in a local store (Samba LDB database) known as the profile store or profile database. One of the profiles in the profile database can be designated as the default profile (which is particularly useful given that most users may only have one). See the profile class documentation for more information.

The general concept is that you create a session object, log in to the session using a selected profile name, and then work with the message_store associated with that session. The message_store is only valid so long as the session is valid.

Examples:

attach_test.cpp, foldertree.cpp, messages.cpp, and test.cpp.


Constructor & Destructor Documentation

libmapipp::session::session ( const std::string &  profiledb = "",
const bool  debug = false 
) throw (std::runtime_error, mapi_exception)

Constructor.

Parameters:
profiledbAn absolute path specifying the location of the profile database. If not specified (or "" is specified) the default location will be used (~/.openchange.profiles.ldb).
debugWhether to output debug information to stdout
libmapipp::session::~session ( ) [inline]

Uninitialize and clean up the MAPI session.


Member Function Documentation

static std::string libmapipp::session::get_default_profile_path ( ) [static]

The path to the default profile database.

This method is not normally required to be called by user applications but might be useful under some circumstances.

mapi_session* libmapipp::session::get_mapi_session ( ) throw () [inline]

The underlying mapi_session.

Exposing this is temporary. Maybe be removed when we sort it out

TALLOC_CTX* libmapipp::session::get_memory_ctx ( ) throw () [inline]

Obtain a talloc memory context for this session.

This pointer can be used for subsequent memory allocations, and these will be cleaned up when the session is terminated.

Referenced by libmapipp::folder::fetch_hierarchy(), and libmapipp::folder::fetch_messages().

message_store& libmapipp::session::get_message_store ( ) throw () [inline]

Obtain a reference to the message_store associated with this session.

Returns:
The message_store associated with this session.
Examples:
attach_test.cpp, foldertree.cpp, messages.cpp, and test.cpp.
std::string libmapipp::session::get_profile_name ( ) const [inline]

The name of the profile that is in use.

Calling this method only makes sense if login() has been called with this session object.

void libmapipp::session::login ( const std::string &  profile_name = "",
const std::string &  password = "" 
) throw (mapi_exception)

Log-in to the Exchange Server.

Parameters:
profile_nameThe name of the profile to use to login with. If not specified (or "" is specified), then the default profile will be used.
passwordThe password to use to login with. It is possible to omit this if the password is stored in the profile database.
Examples:
attach_test.cpp, foldertree.cpp, messages.cpp, and test.cpp.

The documentation for this class was generated from the following file:

Creative Commons License
Creative Commons Attribution icon Creative Commons Share Alike icon
This content is licensed under the Creative Commons
Attribution ShareAlike License v. 3.0:
http://creativecommons.org/licenses/by-sa/3.0/