|
|
テクニカルノート19: Pocket Outlook ファイルへアクセスJune 12, 2002© NSB Corporation. All rights reserved. |
Go to English page.
重要:POOMはPocket PC 2002初期でバイスでは壊れています。修正は可能です。これらのリンク(英語)から詳細情報が入手できます。
必要なのはSP20130.exeをダウンロードして下さい。
MicrosoftのPocket Outlook Object Model (POOM) を使用すると、以下のアプリの組み込みデータベースへの読み書き(read/write)が簡単に行えます。
MicrosoftのWebサイトからドキュメントとファイルをダウンロードする必要があります。このテクニカルノートでは、NS Basic/CEからPOOMを使用する際の、必要事項を要約して説明致します。Microsoftのドキュメントは、Visual C++のプログラマーの観点に立って説明していますので、同じファンクションをNS Basic/CE から行う場合、もっと簡単であることに気が付くでしょう。
インストール
ROMにファイルがまだ入っていない場合、リリースファイルから適切なPIMStore_xxx.dllを、お使いのデバイスに動かし、PIMstore.dllに名前を変更する必要があります。その後、それの登録を済ませて下さい。
HPC および HOC Pro デバイスでは、[start]...[run] とタップし、それからコマンド
regsvrce.exe \windows\pimstore.dll
を入力して下さい。
登録が正常に済んだことを知らせるメッセージを受けるはずです。
原則
POOMはNS Basic/CEが使う他のオブジェクトとほぼ同じです。大きな違いは、プロパティおよびメソッドを持つことに加え、それ自身の中にオブジェクトを持っています。それらのメインオブジェクトは4つあり、各々はFolder Objectと呼ばれます。Folder Object は、Tasks, Appointments, Contacts, Citiesの4つです。getDefaultFolderメソッドを使用することにより、一つのFolder Objectを受取ります。
それぞれのFolder Objectsは、(他のオブジェクト同様)プロパティおよびメソッドを持っており、さらにそれ自身の中に、Itemsと呼ばれるオブジェクトを持っています。Itemsオブジェクトはcountと呼ばれるプロパティを持っており、このプロパティは独立したアイテムがいくつあるかを示します。さらにItemsオブジェクトは、それらのアイテムを含む一つの配列を持っています。これはオブジェクトの集まりで、Itemsと呼ばれます。
これらのアイテムは実際のデータであり、それぞれのアイテムはオブジェクトです。例えば、Contacts内の各名前はオブジェクトであり、Items配列で参照出来ます。アイテムの値はプロパティとして保存されます。例えば、lastname, titleおよびBirthdayは全て、一つのContact Item Objectのプロパティです。
まとめると、4つのレベルのオブジェクトが、階層を形成しています。
1. POOM Object (IPOutlookApp)
2. Folder Objects: Tasks, Appointments, Contacts, Cities (IFolder)
3. Items Object: An array with each Item (IPOutlookItemCollection)
4. Item Object (ICity, IContact, ITask or IAppointment)
ヒント: オブジェクトをあるが、それがどのオブジェクトだか分からない時、typename(object)をして下さい。ICityやIFolderといった具合に、そのオブジェクトのタイプを返します。
1. POOM Object (IPOutlookApp)
You create the POOM object using the AddObject statement as follows:
addobject "pocketOutlook.application","pol"set tasks=pol.getdefaultfolder(13)
pol.logon
'do your processing here
pol.logoff
|
名前 |
タイプ |
解説 |
|
プロパティ |
POOMのバージョン |
|
プロパティ |
0 または 1、ユーザがhome cityにいるかvisiting cityにいるかによる。 |
|
プロパティ |
The home city. |
|
プロパティ |
The visiting city. |
|
プロパティ |
Outlookと同期している場合 |
|
メソッド |
選択されたオブジェクトを返す。Nの値は、 |
|
メソッド |
POOMにユーザをログオンさせる。これは何かをする前に必ず必要です。 |
|
メソッド |
ユーザをログオフさせる。これはあなたのプログラムの最後に必要になります。これを怠ると、次にプログラムを実行させる際、メモリ不足エラーになります。BASIC環境を終了すると、これはクリアされます。 |
2. Folder Objects (Ifolder)
このオブジェクトはアイテムの集まりを得るのに使用されます。
set taskItems=tasks.items
|
Name |
Type |
Notes |
|
プロパティ |
Items Object の集まりを得る。 |
3. Items Object: (IPOutlookItemCollection)
このオブジェクトは個々のアイテムにアクセスする為に使用されます。それぞれのアイテムは別のオブジェクトで、どのフォルダから来るかによって分かれます。それらは、ICity, IContact, ITask, IAppointmentです。
for i=1 to taskItems.count
set taskItem=taskItems.item(i)
print taskItem.subject
next
|
名前 |
タイプ |
解説 |
|
メソッド |
Items Objectのエレメント(i)を返す。 |
|
プロパティ |
Items Objectのアイテム数。 |
|
プロパティ |
Appointmentsのみ。このアイテムの全てのくり返しを含むか?無限もあり! |
|
メソッド |
新しいアイテムの作成。Saveを行うまで保たれていない。 |
|
メソッド |
アイテム(i)を取除く。 |
|
メソッド |
Microsoftドキュメントを参照。 |
|
メソッド |
Microsoftドキュメントを参照。 |
|
メソッド |
Microsoftドキュメントを参照。 |
|
メソッド |
現在のアイテムを保存。 |
|
メソッド |
現在のアイテムを消去。 |
|
メソッド |
現在のアイテムのコピーを作成。 |
|
メソッド |
現在のアイテムを表示。 |
4a. Item Object: ICity
The ICity Object has the following properties:
Print cityItem.airportcode
CityItem.areaCode="416"
|
プロパティ |
タイプ |
|
AirportCode |
文字列 |
|
AreaCode |
文字列 |
|
Country |
文字列 |
|
CountryPhoneCode |
文字列 |
|
InROM |
ブール値(書込み禁止) |
|
Latitude |
long値 |
|
Longitude |
long値 |
|
Name |
文字列 |
|
TimezoneIndex |
long値 |
4b. Item Object: IContact
|
プロパティ |
タイプ |
|
Anniversary |
日付(Date) |
|
AssistantName |
文字列 |
|
AssistantTelephoneNumber |
文字列 |
|
Birthday |
日付(Date) |
|
Body |
文字列 |
|
Business2TelephoneNumber |
文字列 |
|
BusinessAddressCity |
文字列 |
|
BusinessAddressCountry |
文字列 |
|
BusinessAddressPostalCode |
文字列 |
|
BusinessAddressState |
文字列 |
|
BusinessAddressStreet |
文字列 |
|
BusinessFaxNumber |
文字列 |
|
BusinessTelephoneNumber |
文字列 |
|
CarTelephoneNumber |
文字列 |
|
Categories |
文字列 |
|
Children |
文字列 |
|
CompanyName |
文字列 |
|
Department |
文字列 |
|
Email1Address |
文字列 |
|
Email2Address |
文字列 |
|
Email3Address |
文字列 |
|
FileAs |
文字列 |
|
FirstName |
文字列 |
|
Home2TelephoneNumber |
文字列 |
|
HomeAddressCity |
文字列 |
|
HomeAddressCountry |
文字列 |
|
HomeAddressPostalCode |
文字列 |
|
HomeAddressState |
文字列 |
|
HomeAddressStreet |
文字列 |
|
HomeFaxNumber |
文字列 |
|
HomeTelephoneNumber |
文字列 |
|
JobTitle |
文字列 |
|
LastName |
文字列 |
|
MiddleName |
文字列 |
|
MobileTelephoneNumber |
String |
|
OfficeLocation |
文字列 |
|
OtherAddressCity |
文字列 |
|
OtherAddressCountry |
文字列 |
|
OtherAddressPostalCode |
文字列 |
|
OtherAddressState |
文字列 |
|
OtherAddressStreet |
文字列 |
|
PagerNumber |
文字列 |
|
RadioTelephoneNumber |
文字列 |
|
Spouse |
文字列 |
|
Suffix |
文字列 |
|
Title |
文字列 |
|
WebPage |
文字列 |
ITaskの特定のメソッドに関する情報は、Microsoftのドキュメントを確認して下さい。
|
プロパティ |
タイプ |
|
Body |
文字列 |
|
Categories |
文字列 |
|
Complete |
ブール型 |
|
DateCompleted |
日付(Date)(書込み禁止) |
|
DueDate |
日付(Date) |
|
Importance |
long値 (0,1,2) |
|
IsRecurring |
ブール型(書込み禁止) |
|
ReminderOptions |
long値 |
|
ReminderSet |
ブール型 |
|
ReminderSoundFile |
文字列 |
|
ReminderTime |
日付(Date) |
|
Sensitivity |
long値 (0 or 2) |
|
StartDate |
日付(Date) |
|
Subject |
文字列 |
|
TeamTask |
ブール型 |
4D. Item Object: IAppointment
IAppointmentの特定のメソッドに関する情報は、Microsoftのドキュメントを確認して下さい。
|
プロパティ |
タイプ |
|
Subject |
文字列 |
|
Location |
文字列 |
|
Categories |
文字列 |
|
Start |
日付(Date) |
|
Duration |
long値 |
|
End |
日付(Date) |
|
AllDayEvent |
ブール型 |
|
IsRecurring |
ブール型(書込み禁止) |
|
MeetingStatus |
long値(書込み禁止) |
|
Sensitivity |
0=Normal, 1=Private |
|
BusyStatus |
0=Free, 1=Tentative, 2=Busy, 3=OutOfOffice |
|
ReminderSet |
ブール型 |
|
ReminderSoundFile |
文字列 |
|
ReminderOptions |
long値 |
|
ReminderMinutesBeforeStart |
long値 |
|
Body |
文字列 |
REM Demonstrate use of Pocket Outlook
addobject "pocketoutlook.application","pol"
pol.logon()
on error resume next
print "Poom Version:" & pol.version
print "Current City:" & pol.currentCityIndex
print "Home City:" & pol.HomeCity.name
print "Visiting City:" & pol.VisitingCity.name
print "Partnered with Outlook? " & pol.outlookCompatible
'get tasks
set tasks=pol.getdefaultfolder(13)
set taskItems=tasks.items
print "Tasks (" & taskItems.count & ")"
for i=1 to taskItems.count
set taskItem=taskItems.item(i)
print taskItem.subject
next
'create a new task
set newTask=taskItems.add
print typename(newtask)
newTask.subject="New task created by NS Basic/CE"
newTask.save
'get contacts
set contacts=pol.getdefaultfolder(10)
set contactItems=contacts.items
print "Contacts (" & contactItems.count & ")"
for i=1 to contactItems.count
set contactItem=contactItems.item(i)
print contactItem.lastname
next
'get appointments
set appointments=pol.getdefaultfolder(9)
set appointmentItems=appointments.items
print "Appointments (" & appointmentItems.count & ")"
for i=1 to appointmentItems.count
set appointmentItem=appointmentItems.item(i)
print appointmentItem.subject
next
'get cities
set cities=pol.getdefaultfolder(101)
set cityItems=cities.items
print "Cities (" & cityItems.count & ")"
for i=1 to 10
set cityItem=cityItems.item(i)
print cityItem.name
next
pol.logoff