Establishing a POOM Session
A version of this page is also available for
4/8/2010
Before you can create and manipulate PIM items, you must first create an instance of the Outlook Mobile application object, and then use it to establish a POOM session, which opens a connection to the PIM database.
To establish an POOM session
Declare and initialize a pointer to the IPOutlookApp interface object:
IPOutlookApp * g_polApp = NULL;
Initialize COM:
CoInitializeEx( NULL, 0);
Create an Application class COM server object:
CoCreateInstance(CLSID_Application, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void **)&g_pUnknown);
Get a reference to the Outlook Mobile application interface object:
g_pUnknown->QueryInterface(IID_IPOutlookApp, (void**)&g_polApp);
Logon to the Outlook Mobile COM server:
g_polApp->Logon(NULL);
Example
The following code example demonstrates how to create the Outlook Mobile application object and then use it to establish a POOM session.
Note
To make the following code example easier to read, security checking and error handling are not included. This code example should not be used in a release configuration unless it has been modified to include them.
BOOL InitPoom(void)
{
IPOutlookApp * g_polApp = NULL;
IUnknown * g_pUnknown = NULL;
BOOL bSuccess = FALSE;
hr = CoInitializeEx(NULL, 0);
hr = CoCreateInstance(CLSID_Application, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void **)&g_pUnknown);
hr = g_pUnknown->QueryInterface(IID_IPOutlookApp, (void**)&g_polApp);
hr = g_polApp->Logon(NULL);
bSuccess = TRUE;
return bSuccess;
}
To make the code example easier to read, security checking and error handling are not included.
This code example should not be used in a release configuration unless it has been modified to include them.
Compiling the Code
- Include Header File: PimStore.h
- Linker Dependency: PimStore.lib
See Also
Reference
Other Resources
Pocket Outlook Object Model Common Tasks
Pocket Outlook Object Model Application Development