以下のコードでメモにアイテムを追加できる。
$app = New-Object -ComObject Outlook.Application
$item = $app.CreateItem([Microsoft.Office.Interop.Outlook.OlItemType]::olNoteItem)
$item.Body = "test"
$item.Save()
↓ 自己解決 なぜかできるようになった・・・・。
以下のように変数に格納した文字列を Body プロパティに設定するとなぜか空のメモが追加される。
$app = New-Object -ComObject Outlook.Application
$item = $app.CreateItem([Microsoft.Office.Interop.Outlook.OlItemType]::olNoteItem)
$str = "test"
$item.Body = $str
$item.Save()
Body プロパティに固定値をセットすると文字列が設定されるのだが、変数の値をセットしようとすると何故か空になる...。
Name : Windows PowerShell ISE Host
Version : 5.1.17763.316