Skip to main content

Past Blast

Featured Products

Stay in touch using the DEVBUSS RSS feeds.
 

News

Creating POOM items using PIE Web pages

Written by John Cody  [author's bio]  [read 36359 times]
Edited by Derek

Page 1  Page 2 

Creating POOM items using PIE Web pages

The ability to manipule Pocket Outlook items such as Contacts, Appointments and Tasks from an eVB app is a very cool feature. Once the various items are added into the outlook database, your app could filter and display those items based on the user's preferences, or allow the user to quickly find a specific item. However, the process of creating a new outlook item is usually a manual process. The user typically selects "New" and then tediously enters the various text data of the item using the very small SIP keyboard or by writing on the screen. This is not only a time consuming task, but it is prone to errors.

A "Contact" item is particularly time consuming to enter. You typically end up entering a company name, first and last name, telephone number and an email address before saving it.

Wouldn't it be nice to have all of a contacts' data automatically entered into your Pocket PC simply by clicking on a link of a webpage? Well, that's exactly what I am about to show you how to do.

I could have designed an eVB app to accomplish this, but it would require each user to first install the eVB app on their Pocket PC before they can start adding contacts. This method would also has the disadvantage of requiring the user to install continuous program updates on their Pocket PC to facilitate new features or fix bugs with an existing version.

The method I chose does not require any special software to be installed on the user's Pocket PC, so virtually any Pocket PC can immediately utilize my technique to add new contacts right out of the box. In addition, new features and capabilities can be easily added without a single change to the user's Pocket PC.

The key to my technique is PIE's support of JavaScript. Even though I have never programmed in JavaScript before, it was not too difficult to understand because of a few key similarities it has with Basic.

Let's now dive into the details of my technique…

Because JavaScript is a scripting language, it has many of the same capabilities as VBScript, including the key ability to reference ActiveX Objects. Luckily, the ActiveX control 'PIMSTORE.DLL' is included in every Pocket PC's ROM. This was a critical factor in allowing Pocket PC's to use my technique out-of-the-box (without installing any special software).

NOTES:

1) A download which includes more info and example code for using POOM can be found at:
http://www.microsoft.com/mobile/developer/downloads/poomsdk.asp

2) The code below was reported to work on first-generation Casio, HP and iPaq Pocket PC's. However, it appears not to work on the newer Pocket PC's 2002. I am waiting for the PC 2002 upgrade for my test 3135 mono iPaq so I can find out what's happening. It is probably something simply like a slight syntax change such as removing the "()" after calls such as "pol.logon" - which desktop IE requires to work.

The first step in creating a new pocket outlook Contact item, is to create an instance of the Pocket Outlook Object Module (POOM). This is accomplished from within JavaScript as shown below:

var pol;
pol = new ActiveXObject("pocketoutlook.application");

Next, we need to log into the Pocket Outlook Datastore:

pol.logon();

Then, we simply create a reference to a new Contact item:

contact = pol.createitem(2);

Set the various fields of the new contact item:

contact.CompanyName = "deVBuzz.com";
contact.Email1Address = "derek@devbuzz.com";
contact.FirstName = "Derek";
contact.LastName = "Mitchell";
contact.webpage = "http://www.devbuzz.com/pie";
contact.body = "deVBuzz.com is dedicated to …";

Save it and log off:

contact.save();
pol.logoff();

The lines of code above represent the raw code of my technique. But to be truly useful, it needs to reside in a web page/HTML file. Below is a complete HTML file incorporating my technique and even a little extra code to check to see if the contact already exists in the user's database, so it won't add a duplicate entry.

<head><title>Poom Test</title></head>
<body topmargin="0">
&nbsp;<p align="center"><b>Creating Outlook Items via<br>Pocket Internet Explorer<br>
Webpages</b></p>
<p align="center">&nbsp;</p>
<p align="center">By John Cody<br>and deVBuzz.com&nbsp;</p><hr>

<p align="center"><font size="3"><a href="#" onclick="addcontact()"><br>Click Here<br>

</a>To add <b>deVBuzz.com<br>
</b>to your Contact list.
</font></p></body>

Next Page