| 1 | $ErrorActionPreference = 'Stop' |
| 2 | $app = New-Object -ComObject OneNote.Application |
| 3 | $notebook = '' |
| 4 | $app.OpenHierarchy('C:\one-tests\versions\Versions', '', [ref]$notebook, 1) |
| 5 | $section = '' |
| 6 | $app.OpenHierarchy('History.one', $notebook, [ref]$section, 3) |
| 7 | $page = '' |
| 8 | $app.CreateNewPage($section, [ref]$page, 0) |
| 9 | $namespace = 'http://schemas.microsoft.com/office/onenote/2010/onenote' |
| 10 | $app.UpdatePageContent('<one:Page xmlns:one="' + $namespace + '" ID="' + $page + '"><one:Title><one:OE><one:T>Versioned</one:T></one:OE></one:Title><one:Outline><one:Position x="36" y="86"/><one:OEChildren><one:OE><one:T>First state.</one:T></one:OE></one:OEChildren></one:Outline></one:Page>') |
| 11 | $page | Out-File 'C:\one-tests\versions\page.txt' -Encoding UTF8 |