ArianeSoft - Programming and development for Windows and Windows Mobile :: Forums :: PPL - Pocket Programming Language :: Code sharing
 
<< Previous thread | Next thread >>
Accessing POOM - Outlook Contacts, Tasks, etc.
Moderators: kornalius, bmanske, PointOfLight
Author Post
DirectDance
Wed Mar 14 2007, 06:33am
Registered Member #11
Joined: Mon Jul 03 2006, 06:15am
Posts: 157
Hi,

this code sharing example should help to access the POOM library (Calendar, Contacts, etc.) wich is build in your PPC.

First of all, thanks to Kornalius who changed the COM accessing in PPL, version 1.22. Please note, that you will need at least V1.22 of PPL to get access to the POOM functionality.

I am using a PPC WM5.0 device. It seems, that the needed dll (pimstore) is installed and started on those devices on default.

If you are running a version less than WM5.0, it could be, that you will need the eVB runtime to get access to the POOM functionality.

To test, if your device is compatible on default, you could do this:


COMObjects(objects$, -1);
ShowMessage("\ActiveX Objects:\n\n"  + ListToStr(objects$, #13#10, "", "")+" \n");

The result should include a line:

PocketOutlook.Application,pimstore.dll

or something sililar. If not, get the eVB runtime here: http://msdn.microsoft.com/mobility/windowsmobile/downloads/evb.aspx

This is a .cab file wich can be copied to your device and starting it. It installs plenty of dll´s. I hope, after installing the cab file, you should have a entry "PocketOutlook.Application" because, this is the main handle of POOM. As told before, I could not test it, because the pimstore is installed by default on my device. It would be very nice, if somebody using an older device could respond to this thread and tell us if it is correct.

Ok, now back to the POOM access. I will explain it mainly on using the Contacts folder. But it should work with Calendar, Tasks, etc., too. This is, because the POOM structure is equal in every folder structure. The folder structure is like this (simplified):


- Poom Main Entry
  - Folder Contacts
    - Contact Items
  - Folder Calendar
    - Calendar Items
  - Folder Tasks
  - Folder City
  - Folder Infrared


1. Initialize POOM

poom$ = CreateCOMObject(" PocketOutlook.Application");

You will get a main handle to the POOM object. This has to be done only once, e.g. after your program was started. At this point, the variable poom$ is containing the handle but no operations on POOM could be done before log into the POOM object.

2. Logon to the POOM Object

poomlogon$ = Invoke(poom$, "logon");

Now you are connected to POOM.
Please, before closing your application, do not forget to logoff from POOM.

Ok, here are a few examples to play with POOM:

3. Create a new Contact

folder$ = Invoke(poom$, " GetDefaultFolder", 10); // Enter the Contacts Folder (10 for contac ts)
items$ = GetProperty(folder$, "items");  // Set a handle pointer to the Items object  (contacts themselfes)
newContact$ = invoke(items$, "add"); // We would like to ADD a new contact
newContactProp$ = SetProperty(newContact $, "LastName", "Smith"); // Set the LastName variable of POOM to " Smith"
tasksave$ = invoke(newContact$, "save");  // Save the stuff. Without this command, th e new contact wont be saved

Of course, you can assign every datafield of POOM using the SetProperty method (LastName, FirstName, etc.. A complete list of the contact properties can be found on the microsoft websites.

At this point I would like to do the same as in point -3-, but creating a new task

4. Create a new Task

folder$ = Invoke(poom$, " GetDefaultFolder", 13);
items$ = GetProperty(folder$, "items");
newTask$ = invoke(items$, "add");
newtasksubject$ = SetProperty(newTask$,  "subject", "Go shopping");
tasksave$ = invoke(newTask$, "save");


Almost the same as in the contacts folder

5. Load / Search for a contact

folder$ = Invoke(poom$, " GetDefaultFolder", 10); // Explained above
items$ = GetProperty(folder$, "items");  //Explained above
SearchContact$ = invoke(items$, "find" , "[LastName] >= \"A\""); // Search for Contacts where the Lastname i s equal or greater than a letter "A"
ContactOID$ = getproperty(SearchContact$ , "oid"); // Get the OID of the first contact found
loadmycontact$ = invoke(poom$, " GetItemFromOid", ContactOID$); // Load the Contact using the OID
name1$ = getproperty(loadmycontact$, " firstname"); //Get the First Name
name2$ = getproperty(loadmycontact$, " lastname"); //Get the Last Name
showmessage(name1$ % ", " % name2$); // Show the result

The "Find" command is very flexible. For more infos about that command, please have a look into the MS Docs.

Get the next data ("find" will only load the first data)

SearchContact$ = invoke(items$, " findnext");
ContactOID$ = getproperty(SearchContact$ , "oid");
loadmycontact$ = invoke(poom$, " GetItemFromOid", votest$);
name1$ = getproperty(loadmycontact$, " firstname");
name2$ = getproperty(loadmycontact$, " lastname");
showmessage(name1$ % ", " % name2$);


Puh ..., now my fingers are aching.

I hope, the above listed examples will help you creating great apps using PPL.

There are many other possibilities I have not described here. Of course, you can delete, modify, etc. those items.

You will find tons of examples on the internet how to dodiffrent things using POOM. With the above listed examples it should be an easy one to rewrite any example wich was written for e.g. using eVB to PPL.

A last important sentence: PPL is best!

Cheers,
DirectDance
Back to top
zehlein
Wed Mar 14 2007, 12:34pm

Registered Member #30
Joined: Tue Sep 12 2006, 03:00pm
Posts: 449
Thx DD - these examples are great!

There is a crack, a crack in everything. That's how the light gets in. (L. Cohen)
Back to top
bmanske
Wed Mar 14 2007, 01:04pm


Registered Member #5
Joined: Mon May 15 2006, 10:04am
Posts: 122
Great examples! Thanks!
Back to top
matteo.m
Thu Mar 15 2007, 04:45am

Registered Member #8
Joined: Fri Jun 16 2006, 05:40am
Posts: 367
Thanks a lot !!
Back to top
kornalius
Thu Mar 15 2007, 10:30am


Registered Member #1
Joined: Wed Apr 19 2006, 08:25pm
Posts: 2783
Wow, thank you so much for this great tutorial.

Regards,
Alain Deschenes
President and programmer
ArianeSoft Inc. (http://www.arianesoft.ca)
Back to top
Heinz
Thu Mar 22 2007, 11:53am

Registered Member #114
Joined: Tue Oct 24 2006, 01:40pm
Posts: 202
Thanks a lot, Direct Dance!! That is VERY usefull!

regards,
Heinz
Back to top
Slither
Sun Oct 28 2007, 11:15pm
Registered Member #458
Joined: Thu May 24 2007, 02:20am
Posts: 22
Will this work on WM6 please?
Back to top
zehlein
Tue Oct 30 2007, 09:33am

Registered Member #30
Joined: Tue Sep 12 2006, 03:00pm
Posts: 449
The easiest way would be to try and let us know, I think

There is a crack, a crack in everything. That's how the light gets in. (L. Cohen)
Back to top
DirectDance
Tue Oct 30 2007, 10:20am
Registered Member #11
Joined: Mon Jul 03 2006, 06:15am
Posts: 157
No, it is not working on WM6 and some later versions of WM5.

I can proceed the invokes of poom on those devices until the "item" collection but not further.

MS has changed the access of POOM for their own language but not for others anymore
Back to top
Slither
Wed Oct 31 2007, 08:04pm
Registered Member #458
Joined: Thu May 24 2007, 02:20am
Posts: 22
I tried it and copied the Initialise and Logon code followed by the Search/Load example then Logged off.

This is what I got.

APP:
MYAPP_WM2003.EXE
FILE: MYAPP_WM2003.EXE
Proc:WINMAIN
Opcode: INVOKE
Char/Line/Offset: 0, 0,
0x00387e64

(WINMAIN)
Access violation at
0x230a8


Is this a common error I made myself or does this mean that WM6 is changed as stated above.

Cheers,

Slither2006. (Using WM06)

[EDIT] : I installed the eVB and found the above error message goes away. But I get the Address Alignment error message instead whenever I try to access the method to add an item. I showmsg'd the folder$ and items$ variables and are being assigned values.

[ Edited Wed Oct 31 2007, 10:34pm ]
Back to top
Smok Wawelski
Tue Nov 27 2007, 01:02pm
Registered Member #332
Joined: Thu Mar 22 2007, 01:32pm
Posts: 4
I found some more information about POOM: http://www.devbuzz.com/content/zinc_evb_and_poom_pg1.asp . You can find there explanation of those mysterious numbers (10 for contacts etc..).

[ Edited Wed Nov 28 2007, 05:49am ]
Back to top
Slither
Wed Nov 28 2007, 10:56pm
Registered Member #458
Joined: Thu May 24 2007, 02:20am
Posts: 22
Programmed the app in C# POOM without any issues and didn't run into any of the problems i did with PPL....I'm yet to see someone access POOM from WM06 in PPL...Good luck to those who try.
Back to top
PointOfLight
Thu Nov 29 2007, 12:11am

Registered Member #49
Joined: Sun Sep 17 2006, 03:02pm
Posts: 1129
Currently you can't access POOM in WM6 through PPL.  Microsoft broke pimstore.dll access part way through the WM5 lifespan, and has apparently decided not to fix it in favor of forcing people to access POOM through .Net.  Unfortunately, PPL does not take advantage of .Net right now.  Does your C# implementation work on pre-WM5 devices?

Eric Pankoke
Founder
Point Of Light Software
http://www.polsoftware.com/
Back to top
 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System