Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
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

  1. Declare and initialize a pointer to the IPOutlookAppinterface object:

    Copy Code
    IPOutlookApp * g_polApp = NULL;
    
  2. Initialize COM:

    Copy Code
    CoInitializeEx( NULL, 0);
    
  3. Create an Applicationclass COM server object:

    Copy Code
    CoCreateInstance(CLSID_Application, NULL, CLSCTX_INPROC_SERVER,
    IID_IUnknown, (void **)&g_pUnknown);
    
  4. Get a reference to the Outlook Mobile application interface object:

    Copy Code
    g_pUnknown->QueryInterface(IID_IPOutlookApp,
    (void**)&g_polApp);
    
  5. Logon to the Outlook Mobile COM server:

    Copy Code
    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.
Copy Code
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