LoginSignup
1
0

More than 3 years have passed since last update.

PowershellでLotusScriptを実行する

Last updated at Posted at 2020-12-30

PowershellでLotusScriptを利用するの記事を読んで、PowerShellでLotusScriptのクラスがどこまで使えるのかを検証してみました。
※ New-ObjectによるCOMオブジェクトの作成は、[マイクロソフトのドキュメント]を参照しました。
※ リンク先の記事にあるように、32Bit版PowerShellでなければLotusScriptは実行できません。

検証したこと

個人アドレス帳の全文書からUNIDと設計要素(フォーム)を取得するコードを記述して、以下の動作を確認しました。
* Notesデータベースの情報取得
* Notes文書の情報取得
* 繰り返し処理の実行

個人アドレス帳(ローカル)の情報を取得する
$ss = new-object -comobject Lotus.NotesSession
$ss.Initialize("")
# 個人アドレス帳(ローカル)を呼び出す
$db = $ss.GetDatabase("","names.nsf")
#Notesデータベースの情報取得 
#個人アドレス帳(ローカル)の全文書を取得する
$col = $db.AllDocuments
Write-Host "DB内の文書数は : " $col.count
$doc = $col.getFirstDocument()
#繰り返し処理の実行
while ($doc -ne $null)
{$item = $doc.UniversalId
$form = $doc.GetItemValue("Form")
$i++
#Notes文書の情報取得
Write-Host $i "番目の文書IDは : " $item
Write-Host $i "番目の文書フォームは : " $form
$doc = $col.getNextDocument($doc)
}

pause

実行結果
実行結果.png

感想

単純な処理(特にデータを抽出するだけの処理)であれば、デグレーションを引き起こす可能性があるNotesデータベースの改修ではなく、PowerShellを利用したほうが良いのではと感じました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0