For complete information about the Pocket Outlook Object Model,
visit the Microsoft site listed above and download a copy today. Included with the SDK is
a version of the file, pimstore.dll for the Intel 486, Strong Arm, MIPS 3000 , MIPS 4000,
SH3 and SH4 processors. You will need to download and register the version matching your
processor before you can work with the sample included here.
Although there are many different actions available to the developer using this SDK, I
am going to briefly show how to get started by adding an appointment to the Calendar. Get
the SDK, read the documentation and experiment. You will be surprised with what you can do
with it. Download the sample for the complete code and a Flight Scheduler application.
You should have already downloaded and installed the file pimstore.dll on your device.
Next open up Visual Basic and create a new H/PC application. You should add the following
line of code to the General Declaration section of Form1:
Dim pol as PocketOutlook.Application
This will bind the pimstore.dll to application during run-time. This is the only object
that needs to be declared. Next, we need to create an instance of the Pocket Outlook
session by creating the Pocket Outlook Application object:
Set pol = CreateObject("PocketOutlook.Application")
The application object supports the following methods:
- Logon
- Logoff
- GetDefaultFolder
- CreateItem
- ReceiveFromInfrared
- GetTimeZoneFromIndex
- GetTimeZoneInformationFromIndex
- GetItemFromOidSysFreeString
I am only going to go over the first 4 items in this sample. After creating the Pocket
Outlook session, we need to log the user into the session. Unlike, the PC version of
Outlook, there is no namespace object and we do not need a username and password to logon
to the session. So the first call to Pocket Outlook, must be:
pol.Logon
As expected, our last call to Pocket Outlook application object, should be:
pol.Logout
This logs the user off of a Pocket Outlook session.
Pocket Outlook is made up of 5 folders, Contacts, Cities, Tasks, Appointments and
Infrared. Only the first 4 folders can be used to access or create individual Pocket
Outlook items. These folders are provided as a means of containing the Items collection.
You can not create, delete or manipulate these folders. To access a folders Items
collection you call the GetDefaultFolder method.
Set pFolder = pol.GetDefaultFolder(101)
The parameter that is passed is the identifier for the folder that is to be retrieved.
| Folder Type |
Value |
| Calendar |
9 |
| Contacts |
10 |
| Tasks |
13 |
| Cities |
101 |
| Infrared |
102 |
As an example, you would access the Cities collection in the World Clock by:
Set pFolder = pol.GetDefaultFolder(101)
Set pCity = pFolder.Items
For i = 1 To pCity.Count
Set cityItem = pCity.Item(i)
dCity.AddItem cityItem.Name
Next i
The last method that I am going to look at today, is the CreateItem method. This
function is called to create a task, an appointment or contact. This function allows the
developer to create an item without first having to work their way down to the appropriate
folder. When you create an item this way, it is only in memory and will not be added to
the folder until it is saved. The following will create a new appointment:
Set appointment = pol.CreateItem(1)
The parameter passed is the type of item to be created.
| Item Type |
Value |
| Appointment |
1 |
| Contact |
2 |
| Tasks |
3 |
| City |
101 |
This Appointment item supports the following properties:
Property Type
| Subject |
String |
| Location |
String |
| Categories |
String |
| Start |
Date |
| Duration |
Long |
| End |
Date |
| AllDayEvent |
Boolean |
| IsRecurring |
Boolean ReadOnly |
| MeetingStatus |
Long ReadOnly |
| Sensitivity |
Long Normal=0 Private=2 |
| BusyStatus |
Long |
Free=0, Tentative=1, Busy=2, Out of Office=3
| ReminderSet |
Boolean |
| ReminderSoundFile |
String |
| ReminderOptions |
Long |
| ReminderMinutesbeforeStart |
Long |
| Recipients |
Irecipients ReadOnly |
| Body |
String |
| BodyInk |
CEBLOB |
MeetingStatus is read-only. An appointment that has recipients is automatically
a meeting. The Start, Duration and End properties are all related. If
you set all three, the Duration is ignored. If you set either Start or End
with Duration, then the other one will be calculated. There are some rules that you
must follow when creating an appointment. The Subject can only be 4096 characters
in length. The Location property can only be 1024 characters. The Body is
limited to 20K. Dates must be within the range of 1/1/1900 to 12/32/2999. The Start
property must be equal to or less than the End property. Duration must be
less than 31 days and the ReminderMinutesBeforeStart must be less than 45 days.
Below is a code example of creating an appointment:
appointment.Subject = "Flight - " & dCity.Text & " to "
& aCity.Text
appointment.Location = Airline.Text & " Flight:" & FlightNumber.Text
appointment.Categories = "Travel"
appointment.BusyStatus = 3
sTime = dDate.Text & " " & dTime.Text
eTime = aDate.Text & " " & aTime.Text
appointment.Start = CDate(sTime)
appointment.Duration = 1
appointment.End = CDate(eTime)
appointment.Body = sComment.Text
We now have created our new appointment, but as stated earlier, it is in memory
only. In order to commit it to the calendar, we need to call the Save method:
pol.Save
Now to finish off our sample, we want to look at the appointment just created. A call
to Display (pol.Display) will display an item. This will display the new item just
created. You may add or modify any information to this display.

This has been a quick introduction to the Pocket Outlook Object Model. It is fairly
simple to access in Visual Basic and in my opinion opens up many new areas for application
developers. Enjoy!