Skip to main content

Past Blast

Featured Products

Windows Mobile Developer Controls
Windows Mobile Developer Controls
Stay in touch using the DEVBUSS RSS feeds.
 

News

Windows Mobile Developer Controls
Sapphire Soltuions

Creating POOM items using PIE Web pages

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

Page 1  Page 2 

<script language="Javascript">
function addcontact()
{
var pol;
var contacts;
var contact;
var size;
var dup;

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

// contactfind
dup = false;
contacts = pol.GetDefaultFolder(10).items;
size = contacts.count;
while (size > 0) {
contact = contacts.item(size);
if (contact.companyname == "deVBuzz.com") {
alert ("Duplicate found, Skipping Addition");
dup = true;
break;
}
size--;
}
// contactadd
if (dup == false) {
contact = pol.createitem(2);
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 eMbedded Visual Basic (eVB) development for Windows CE devices. We have information on all levels of eVB programming - from seasoned eVB developers to novices just starting out on the Pocket PC or Handheld platform.";
contact.save();
alert ("deVBuzz.com has been added to your Contacts!");
}
// contactdone
pol.Logoff();
}
</script>

Note that the link anchor reference includes onclick="addcontact()". This is what actually invokes the addcontact routine when the link is clicked by the user. The routine could also be automatically invoked without requiring the user to click on a link by replacing the opening BODY tag with:

<BODY Topmargin=0 onload="addcontact()">

If you would like to try this demo webpage live on the Internet, I have the above HTML demo webpage hosted on my site at:

http://www.omnisoft.com/pocketpc/poom.htm

NOTE: The above demo will only work when viewed using Pocket Internet Explorer.

Below is a screen shot of the above HTML file:

If you do not already have "deVBuzz.com" in your contact list, the below dialog will appear, confirming the new addition:

And the below dialog will appear if you click on the link a second time after the contact has already been added:

As you can see, the data added, and the method of how it is added is totally controlled by the JavaScript code within the HTML file. This gives the webmaster full control and the freedom to update the link's functionality at any time.

In conclusion, I hope this article starts to get your mind grinding away with new ideas. Keep in mind that my method is not limited to just adding new contacts. You could just as easily add a new Appointment or Task. For example, a corporate webpage could have a link on it that adds an appointment for the next employee meeting, complete with a one-hour advanced alarm notice. The uses for this technique are limited only by your imagination. If you come up with a cool application that uses my technique, I would love to hear about it ;)

Previous Page