ClientApplication Class Reference
[Outlook Wrapper]

The main class of Outlook wrapper, used to wrap Outlook Application instance, MAPI namespace and Redemption utility methods. More...

#include <ClientApplication.h>

Collaboration diagram for ClientApplication:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ~ClientApplication ()
 Destructor.
const std::wstring & getVersion ()
const std::wstring & getName ()
ClientFoldergetDefaultFolder (const std::wstring &itemType)
 Returns the default ClientFolder for the specific item type.
ClientFoldergetFolderFromID (const std::wstring &folderID)
 Returns the ClientFolder from its entryID.
ClientFolderpickFolder ()
 Returns the ClientFolder manually selected by the user.
ClientFolderpickFolder (const std::wstring &itemType)
 Returns the ClientFolder manually selected by the user.
ClientFoldergetFolderFromPath (const std::wstring &itemType, const std::wstring &path)
 Returns the ClientFolder from the full folder path (eg "\\Personal Folders\Contacts").
ClientFoldergetDefaultRootFolder ()
 Returns the default root folder (index = 0).
ClientFoldergetRootFolder (const int index)
 Returns the root folder from its index.
ClientFoldergetRootFolderFromName (const std::wstring &folderName)
 Returns the root folder from its name.
ClientItemgetItemFromID (const std::wstring &itemID, const std::wstring &itemType)
 Returns the ClientItem from its entryID.
HRESULT cleanUp ()
 To release shared session of Outlook.
std::wstring getSMTPfromEX (const std::wstring &EXAddress)
 Utility to convert an Exchange mail address into a SMTP address.
std::wstring getBodyFromID (const std::wstring &itemID)
 Utility to get body of a specified item (used for notes body which is protected).
std::wstring getCurrentProfileName ()
 Utility to retrieve the userName of current Outlook profile used.
const bool isLoggedOn ()
 Returns true if Outlook MAPI object is logged on.

Static Public Member Functions

static ClientApplicationgetInstance ()
 Method to create the sole instance of ClientApplication.
static bool isInstantiated ()
 Returns true if static instance is not NULL.

Protected Member Functions

 ClientApplication ()
 Constructor.

Private Member Functions

void createSafeInstances ()
 Creates instances for Redemption COM pointers:
  • MAPIUtils (used for notes body)
  • RDOSession (used for EX->SMTP addresses).


Private Attributes

std::wstring version
 Version of Client used.
std::wstring programName
 Name of Client used.
_ApplicationPtr pApp
_NameSpacePtr pMAPI
MAPIFolderPtr pFolder
Redemption::IMAPIUtilsPtr pRedUtils
Redemption::IRDOSessionPtr rdoSession
ClientFolderfolder
ClientMail * mail
ClientContactcontact
ClientAppointmentappointment
ClientTasktask
ClientNotenote
HRESULT hr
 Result of COM pointers operations.

Static Private Attributes

static ClientApplicationpinstance = NULL
 pointer to ClientApplication instance

Detailed Description

The main class of Outlook wrapper, used to wrap Outlook Application instance, MAPI namespace and Redemption utility methods.

Start from the unique instance of this class (it's a singleton) to get the desired ClientFolder, and the desired ClientItem. Class methods automatically catch and manage COM pointers exceptions. Class methods throw ClientException pointer in case of error.


Constructor & Destructor Documentation

ClientApplication::ClientApplication (  )  [protected]

Constructor.

Creates a new instance of Outlook application then logs in. Initializes version & programName.

ClientApplication::~ClientApplication (  ) 

Destructor.

Log off and clean up shared objects, delete internal objects.


Member Function Documentation

ClientFolder * ClientApplication::getDefaultFolder ( const std::wstring &  itemType  ) 

Returns the default ClientFolder for the specific item type.

Note:
the pointer returned is a reference to the internal ClientFolder. (the internal object is fred in the destructor)

ClientFolder * ClientApplication::getFolderFromID ( const std::wstring &  folderID  ) 

Returns the ClientFolder from its entryID.

Note: the pointer returned is a reference to the internal ClientFolder. (the internal object is fred in the destructor)

ClientFolder * ClientApplication::pickFolder (  ) 

Returns the ClientFolder manually selected by the user.

No item type verification is performed. Note: the pointer returned is a reference to the internal ClientFolder. (the internal object is fred in the destructor)

ClientFolder * ClientApplication::pickFolder ( const std::wstring &  itemType  ) 

Returns the ClientFolder manually selected by the user.

If 'itemType' is not empty string, verifies if folder selected is correct for the item type passed. Note: the pointer returned is a reference to the internal ClientFolder. (the internal object is fred in the destructor)

ClientFolder * ClientApplication::getFolderFromPath ( const std::wstring &  itemType,
const std::wstring &  path 
)

Returns the ClientFolder from the full folder path (eg "\\Personal Folders\Contacts").

If empty (or "\\" or "/") path passed, the default folder will be returned. If correspondent folder does not exist, it will be created.

Note:
the pointer returned is a reference to a internal object (internal objects are fred in the destructor)

ClientFolder * ClientApplication::getDefaultRootFolder (  ) 

Returns the default root folder (index = 0).

Root folders are the Outlook data files folders (this should be "Personal Folder").

ClientFolder * ClientApplication::getRootFolder ( const int  index  ) 

Returns the root folder from its index.

Root folders are the Outlook data files folders (e.g. "Personal Folder"). If folder not found returns NULL. Note: the pointer returned is a reference to the internal ClientFolder. (the internal object is freed in the destructor) 'index + 1' is used, as first outlook folder has index = 1.

ClientFolder * ClientApplication::getRootFolderFromName ( const std::wstring &  folderName  ) 

Returns the root folder from its name.

Root folders are the Outlook data files folders (e.g. "Personal Folder"). If folder not found returns NULL. Note: the pointer returned is a reference to the internal ClientFolder. (the internal object is fred in the destructor)

ClientItem * ClientApplication::getItemFromID ( const std::wstring &  itemID,
const std::wstring &  itemType 
)

Returns the ClientItem from its entryID.

The object returned is the specific ClientItem based on 'itemType' (i.e. if itemType is CONTACT, will return an ClientContact object) Returns NULL if the itemID corresponds to a bad item for the item-type.

Note: the pointer returned is a reference to the internal ClientItem. (the internal object is fred in the destructor)

HRESULT ClientApplication::cleanUp (  ) 

To release shared session of Outlook.

This function avoids Outlook being instable after usage of Redemption. Release:

wstring ClientApplication::getSMTPfromEX ( const std::wstring &  EXAddress  ) 

Utility to convert an Exchange mail address into a SMTP address.

Note:
this method uses the redemption library (RDOSession object). It is placed here because the RDOSession object needs to be linked to Outlook MAPI.
Parameters:
EXAddress : the EX address to be converted
Returns:
: the SMTP address if found (else empty string)

wstring ClientApplication::getBodyFromID ( const std::wstring &  itemID  ) 

Utility to get body of a specified item (used for notes body which is protected).

Note:
: this method uses the redemption library (MAPIUtils object). It is placed here because the MAPIUtils object needs to be linked to Outlook MAPI.
Parameters:
itemID : the ID of item to search
Returns:
: the value of 'body' property

wstring ClientApplication::getCurrentProfileName (  ) 

Utility to retrieve the userName of current Outlook profile used.

In case of errors, or not yet logged on Outlook, throws a ClientException.

Note:
this method uses the redemption library (RDOSession object).


The documentation for this class was generated from the following files:
Generated on Fri Nov 9 12:21:31 2007 for Funambol Outlook Plug-in Library by  doxygen 1.5.2