Chapter 18: Working with POOM

Posted by Apress Free Book | Pocket PC January 05, 2009
The Pocket Outlook Object Model is the gateway to Outlook-specific data. POOM is not only a fun word to say, but also a powerful resource for developers. POOM allows you to integrate seamlessly your mobile applications into the standard core applications found on every Pocket PC.

Working with the Pocket Outlook .NET Component

Once you've downloaded and installed the Pocket Outlook .NET component, there are a few steps that you need to perform to make use of this component within your .NET Compact Framework applications:

  1. Add a reference to the Pocket Outlook .NET component.
  2. Import the PocketOutlook namespace.
  3. Define the OutlookApplication object.
These steps are detailed in the following sections.

Adding a Reference to the Pocket Outlook .NET Component

The first step that you need to perform is to add a reference to the Pocket Outlook .NET component. To accomplish this, perform the following steps:
  1. With your project open, in the Solutions Explorer window right-click the References folder.
  2. From the pop-up menu, select Add Reference.
  3. The Add Reference dialog box will display. From the list at the top of this dialog box, select InTheHand.PocketOutlook.
  4. Click the Select button. The InTheHand.PocketOutlook component will be added to the Selected Components window at the bottom of the dialog box as shown in Figure 18-1.

    Figure 18 - 1. Adding the reference to the Pocket Outlook component

  5. Click the OK button, adding the reference to your project.
Importing the PocketOutlook Namespace

The second step that you need to perform is to add an Imports statement at the top of your form module. To accomplish this, perform the following steps:
  1. Open the code window for your form.
  2. Navigate to the top of that code window.
  3. Add the following line of code to the module:

    Imports InTheHand.PocketOutlook
Defining the OutlookApplication Object

The third step that you need to perform is to declare a variable for the OutlookApplication object. This object is the interface to the Pocket Outlook Object Model. You must always include it in your application.

Following is an example of declaring a variable for this object. Typically, this declaration will occur at the module or project level of your application, so that the OutlookApplication is available across a broad scope.

[at the module level]
Dim poApplication As New OutlookApplication

NOTE When this line of code executes, your application automatically logs in to the Pocket Outlook data source. Unlike working with POOM directly, where you need to log in before performing any task, the InTheHand Pocket Outlook .NET component performs this step for you.

Obtaining Help on the Pocket Outlook .NET Component

The installation package for the Pocket Outlook .NET component includes a help file titled Object Model Documentation. The installation process creates a shortcut to this document. To access this documentation, perform the following steps:
  1. Click the Start menu.
  2. From the Start menu, select Programs.
  3. From Programs, select InTheHand.
  4. From InTheHand, select Pocket Outlook .NET Wrapper.
  5. From Pocket Outlook .NET Wrapper, select the shortcut to Object Model Documentation.
This help system provides an overview of the object hierarchy provided through the Pocket Outlook .NET component. It's not intended as a how-to guide, but rather as a reference. If you're looking for how-to material, then the rest of this chapter is for you, starting with how to work with Pocket Outlook tasks.

An Important Consideration for Developers Using POOM

When developing an application that uses POOM to modify and query data within Pocket Outlook, you must always keep in mind that the data you are working with is also accessible directly by the user from the native applications themselves-Contacts, Appointments, and Tasks. What that means is the data you are incorporating into your application may be altered outside of your application in a way that may adversely affect your programming scheme.

Total Pages : 9 12345