Submitted By: Kent Finkle

Creates a new note in Microsoft Outlook.

PowerShell
Edit|Remove
$comments = @'
Script name: Create-Note.ps1
Created on: Saturday, September 29, 2007
Author: Kent Finkle
Purpose: How can I use Windows Powershell to
Create a New Note in Microsoft Outlook?
'@
#-----------------------------------------------------
function Release-Ref ($ref) {
([System.Runtime.InteropServices.Marshal]::ReleaseComObject(
[System.__ComObject]$ref) -gt 0)
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers() 
}
#-----------------------------------------------------
$olNote = 5
 
$o = new-object -comobject outlook.application

$note = $o.CreateItem($olNote)
 
$note.Body = "a slice of Rappie Pie"
 
[void] $note.Save()
 
$a = Release-Ref($note)
$a = Release-Ref($o)