FREE BOOK

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.

INCLUDED AS PART OF THE software bundled with every Pocket PC is a set of applications that are referred to jointly as Pocket Outlook. Individually, these are the Calendar, Contacts, Inbox, Notes, and Tasks applications.

Although functionally these applications operate in a stand-alone fashion, they are designed for use in conjunction with their larger, better-known desktop equivalent, Microsoft Outlook. Between these two platforms of PIM applications resides ActiveSync, which natively handles synchronizing data between Microsoft Outlook and the Pocket Outlook applications.

From the development point of view, Pocket Outlook offers two opportunities. First, it provides a repository of specific data, that being contacts, appointments, and tasks. Second, it comes with automatic synchronization, allowing you to be worry free of how this data moves between a device and its associated PC.

The Pocket Outlook Object Model

Applications access Pocket Outlook data through the Pocket Outlook Object Model, or as it's more commonly referred to, POOM. This COM-based library provides an object hierarchy that simplifies the process of creating, modifying, and displaying appointments, tasks, and contacts.

The problem is that, unlike applications written in eMbedded Visual C++ or eMbedded Visual Basic, those that target the .NET Compact Framework don't natively have access to COM libraries, which means, among other things, you can't directly leverage POOM.

As with all NETCF-to-COM situations, the workaround is to create a non- COM dynamic link library, or DLL. This DLL acts as a go-between for your NETCF application and the COM object. The DLL is written using eMbedded Visual C++, which as I've already mentioned can directly access COM objects, including POOM. The DLL exposes a standard NETCF-friendly interface that in turn can be PInvoked from your application.

Now, as you may have already guessed, this isn't a trivial process. It requires a detailed understanding of eMbedded Visual C++, the Pocket Outlook Object Model, and creating DLLs and PInvoking DLLs from a NETCF application. Given the right amount of time and effort, you probably could struggle through this on your own. Luckily, there are two sources of aid that can significantly shorten this process: the POOM sample on the GotDotNet Web site and the Pocket Outlook .NET component offered by InTheHand.

GotDotNet's POOM Sample

The POOM sample offered on the GotDotNet Web site demonstrates creating a DLL written in eMbedded Visual C++. You learn how to call this DLL from a NETCF application. While somewhat limited in functionality, offering access to contacts only, it does show the key points and concepts behind leveraging POOM from a .NET Compact Framework application.

One downside of this sample is that it's written completely in eMbedded Visual C++, and converting the NETCF component to Visual Basic .NET isn't a trivial task. This sample is available for download at http://www.gotdotnet.com/team/netcf/ Samples.aspx.

InTheHand's Pocket Outlook .NET


The second option available to NETCF developers is the Pocket Outlook .NET component from InTheHand, a software development shop that specializes in NETCF. Pocket Outlook .NET is a set of .NET classes that allow full read/write access to the Appointments, Contacts, and Tasks features of Pocket Outlook.

Unlike the GotDotNet sample application, Pocket Outlook .NET is a library DLL that you can add to your .NET Compact Framework projects to provide a robust object hierarchy. This greatly simplifies incorporating POOM into your applications.

The Pocket Outlook .NET library supports data binding, so you can quickly build PIM-enabled applications using standard NETCF components such as the DataGrid and ComboBox.

From my point of view, Pocket Outlook .NET is the way to go when you need to work with Pocket Outlook data. It's easy to use, offers the right set of features, and is priced right for even the smallest of development shops. This is a cool product. In fact, all of the examples and tutorials in the remainder of this chapter utilize Pocket Outlook .NET.

For more information on this product, see http://www.inthehand.com.

Accessing POOM from NETCF

As I've already mentioned, there are two ways to access POOM from the .NET Compact Framework. The first involves creating your own native-code DLL. Detailing this approach is outside of the scope of this chapter because of its complexity.

The second approach makes use of the Pocket Outlook .NET component from InTheHand. All of the examples and tutorials that follow make use of this component. You'll need to download and install this component to follow along or utilize any of the techniques demonstrated in the remainder of this chapter.

Total Pages : 9 12345

comments