libmapi/cdo_mapi.c File Reference

MAPI subsystem related operations. More...

#include "libmapi/libmapi.h"
#include "libmapi/libmapi_private.h"

Functions

_PUBLIC_ enum MAPISTATUS GetLoadparmContext (struct mapi_context *mapi_ctx, struct loadparm_context **lp_ctx)
_PUBLIC_ enum MAPISTATUS MAPIInitialize (struct mapi_context **_mapi_ctx, const char *profiledb)
_PUBLIC_ enum MAPISTATUS MapiLogonEx (struct mapi_context *mapi_ctx, struct mapi_session **session, const char *profname, const char *password)
_PUBLIC_ enum MAPISTATUS MapiLogonProvider (struct mapi_context *mapi_ctx, struct mapi_session **session, const char *profname, const char *password, enum PROVIDER_ID provider)
_PUBLIC_ void MAPIUninitialize (struct mapi_context *mapi_ctx)
_PUBLIC_ enum MAPISTATUS SetMAPIDebugLevel (struct mapi_context *mapi_ctx, uint32_t level)
_PUBLIC_ enum MAPISTATUS SetMAPIDumpData (struct mapi_context *mapi_ctx, bool status)

Detailed Description

MAPI subsystem related operations.


Function Documentation

_PUBLIC_ enum MAPISTATUS GetLoadparmContext ( struct mapi_context mapi_ctx,
struct loadparm_context **  lp_ctx 
)

Retrieve the MAPI loadparm context for specified MAPI context

Parameters:
mapi_ctx pointer to the MAPI context
lp_ctx pointer to a pointer to the loadparm context that the function returns
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_INITIALIZED or MAPI_E_INVALID_PARAMETER

References mapi_context::lp_ctx, and OPENCHANGE_RETVAL_IF.

_PUBLIC_ enum MAPISTATUS MAPIInitialize ( struct mapi_context **  _mapi_ctx,
const char *  profiledb 
)

Initialize mapi context structure

This function inititalizes the MAPI subsystem and open the profile database pointed by profiledb .

Parameters:
_mapi_ctx pointer to the MAPI context
profiledb profile database path
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI error.
Note:
Developers may also call GetLastError() to retrieve the last MAPI error code. Possible MAPI error codes are:
  • MAPI_E_NOT_INITIALIZED: MAPI subsystem has not been initialized
  • MAPI_E_NOT_ENOUGH_RESOURCES: MAPI subsystem failed to allocate the necessary resources to operate properly
  • MAPI_E_NOT_FOUND: No suitable profile database was found in the path pointed by profiledb
  • MAPI_E_CALL_FAILED: A network problem was encountered during the transaction
See also:
MAPIUninitialize
Examples:
fetchappointment.c, fetchmail.c, and mapi_sample1.c.

References mapi_context::dumpdata, mapi_context::ldb_ctx, mapi_context::lp_ctx, mapi_context::mem_ctx, OPENCHANGE_RETVAL_IF, OpenProfileStore(), and mapi_context::session.

_PUBLIC_ enum MAPISTATUS MapiLogonEx ( struct mapi_context mapi_ctx,
struct mapi_session **  session,
const char *  profname,
const char *  password 
)

Create a full MAPI session

Open providers stored in the profile and return a pointer on a IMAPISession object.

Parameters:
mapi_ctx pointer to the MAPI context
session pointer to a pointer to a MAPI session object
profname profile name to use
password password to use for the profile

password should be set to NULL if the password has been stored in the profile.

Returns:
MAPI_E_SUCCESS on success otherwise MAPI error.
Note:
Developers may also call GetLastError() to retrieve the last MAPI error code. Possible MAPI error codes are:
  • MAPI_E_NOT_INITIALIZED: MAPI subsystem has not been initialized
  • MAPI_E_NOT_ENOUGH_RESOURCES: MAPI subsystem failed to allocate the necessary resources to operate properly
  • MAPI_E_CALL_FAILED: A network problem was encountered during the transaction
See also:
MAPIInitialize, OpenProfile, MapiLogonProvider
Examples:
fetchappointment.c, fetchmail.c, and mapi_sample1.c.

References MapiLogonProvider(), PROVIDER_ID_EMSMDB, and PROVIDER_ID_NSPI.

_PUBLIC_ enum MAPISTATUS MapiLogonProvider ( struct mapi_context mapi_ctx,
struct mapi_session **  session,
const char *  profname,
const char *  password,
enum PROVIDER_ID  provider 
)

Initialize a session on the specified provider

Parameters:
mapi_ctx pointer to the MAPI context
session pointer to a pointer to a MAPI session object
profname profile name
password profile password
provider provider we want to establish a connection on

password should be set to NULL if the password has been stored in the profile.

Supported providers are:

  • PROVIDER_ID_NSPI: Address Book provider
  • PROVIDER_ID_EMSMDB: MAPI Store provider
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI error.
Note:
Developers may also call GetLastError() to retrieve the last MAPI error code. Possible MAPI error codes are:
  • MAPI_E_NOT_INITIALIZED: MAPI subsystem has not been initialized
  • MAPI_E_NOT_ENOUGH_RESOURCES: MAPI subsystem failed to allocate the necessary resources to operate properly
  • MAPI_E_CALL_FAILED: A network problem was encountered during the transaction
See also:
MapiLogonEx, OpenProfile, LoadProfile

References mapi_session::emsmdb, emsmdb_disconnect_dtor(), LoadProfile(), Logon(), mapi_session::logon_ids, mapi_session::mapi_ctx, mapi_context::mem_ctx, mapi_session::next, mapi_session::nspi, nspi_disconnect_dtor(), OPENCHANGE_RETVAL_IF, OpenProfile(), mapi_session::profile, PROVIDER_ID_EMSMDB, PROVIDER_ID_NSPI, and mapi_context::session.

Referenced by DuplicateProfile(), and MapiLogonEx().

_PUBLIC_ void MAPIUninitialize ( struct mapi_context mapi_ctx  ) 

Uninitialize MAPI subsystem

Parameters:
mapi_ctx pointer to the MAPI context

This function uninitializes the MAPI context and destroy recursively the whole mapi session and associated objects hierarchy

See also:
MAPIInitialize, GetLastError
Examples:
fetchappointment.c, fetchmail.c, and mapi_sample1.c.

References mapi_notify_ctx::fd, mapi_context::mem_ctx, mapi_session::notify_ctx, and mapi_context::session.

_PUBLIC_ enum MAPISTATUS SetMAPIDebugLevel ( struct mapi_context mapi_ctx,
uint32_t  level 
)

Set MAPI debug level

Parameters:
mapi_ctx pointer to the MAPI context
level the debug level to set
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI error.
Note:
Developers may also call GetLastError() to retrieve the last MAPI error code. Possible MAPI error codes are:
  • MAPI_E_NOT_INITIALIZED: MAPI subsystem has not been initialized
  • MAPI_E_INVALID_PARAMETER: the function parameter is invalid

References mapi_context::lp_ctx, mapi_context::mem_ctx, and OPENCHANGE_RETVAL_IF.

_PUBLIC_ enum MAPISTATUS SetMAPIDumpData ( struct mapi_context mapi_ctx,
bool  status 
)

Enable MAPI network trace output

Parameters:
mapi_ctx pointer to the MAPI context
status the status

possible status values/behavior:

  1. true: Network traces are displayed on stdout
  2. false: Network traces are not displayed on stdout
Returns:
MAPI_E_SUCCESS on success, otherwise MAPI_E_NOT_INITIALIZED

References mapi_context::dumpdata, and OPENCHANGE_RETVAL_IF.


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/