#include <ClientApplication.h>
Collaboration diagram for ClientApplication:
Public Member Functions | |
~ClientApplication () | |
Destructor. | |
const std::wstring & | getVersion () |
const std::wstring & | getName () |
ClientFolder * | getDefaultFolder (const std::wstring &itemType) |
Returns the default ClientFolder for the specific item type. | |
ClientFolder * | getFolderFromID (const std::wstring &folderID) |
Returns the ClientFolder from its entryID. | |
ClientFolder * | pickFolder () |
Returns the ClientFolder manually selected by the user. | |
ClientFolder * | pickFolder (const std::wstring &itemType) |
Returns the ClientFolder manually selected by the user. | |
ClientFolder * | getFolderFromPath (const std::wstring &itemType, const std::wstring &path) |
Returns the ClientFolder from the full folder path (eg "\\Personal Folders\Contacts"). | |
ClientFolder * | getDefaultRootFolder () |
Returns the default root folder (index = 0). | |
ClientFolder * | getRootFolder (const int index) |
Returns the root folder from its index. | |
ClientFolder * | getRootFolderFromName (const std::wstring &folderName) |
Returns the root folder from its name. | |
ClientItem * | getItemFromID (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 ClientApplication * | getInstance () |
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:
| |
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 |
ClientFolder * | folder |
ClientMail * | |
ClientContact * | contact |
ClientAppointment * | appointment |
ClientTask * | task |
ClientNote * | note |
HRESULT | hr |
Result of COM pointers operations. | |
Static Private Attributes | |
static ClientApplication * | pinstance = NULL |
pointer to ClientApplication instance |
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.
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.
ClientFolder * ClientApplication::getDefaultFolder | ( | const std::wstring & | itemType | ) |
Returns the default ClientFolder for the specific item type.
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.
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.
EXAddress | : the EX address to be converted |
wstring ClientApplication::getBodyFromID | ( | const std::wstring & | itemID | ) |
Utility to get body of a specified item (used for notes body which is protected).
itemID | : the ID of item to search |
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.