├── OneNoteUtilities
├── OneNoteUtilities.psd1
├── OneNoteUtilities.psm1
└── en-US
│ ├── OneNoteUtilities-help.xml
│ └── about_OneNoteUtilities.help.txt
├── README.md
└── docs
├── Add-ONElement.md
├── Get-ONHierarchy.md
├── Get-ONNoteBook.md
├── Get-ONNoteBooks.md
├── Get-ONPage.md
├── Get-ONPages.md
├── Get-ONSection.md
├── Get-ONSectionGroups.md
├── Get-ONSections.md
├── New-ONElement.md
├── New-ONPage.md
├── Publish-ONObject.md
├── Show-ONGUI.md
├── Show-OnPage.md
├── Start-ONApp.md
├── Stop-ONApp.md
└── Update-ONPage.md
/OneNoteUtilities/OneNoteUtilities.psd1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wightsci/OneNoteUtilities/78875713f62558ddbb061af0acce9d6889496b92/OneNoteUtilities/OneNoteUtilities.psd1
--------------------------------------------------------------------------------
/OneNoteUtilities/OneNoteUtilities.psm1:
--------------------------------------------------------------------------------
1 | # Set up some variables
2 | $onApp = $Null
3 | $xmlSections=''
4 | $strPages=''
5 | $pageID=''
6 | $xmlPage = New-Object System.Xml.XmlDocument
7 | $xmlNewPage = New-Object System.Xml.XmlDocument
8 | $xmlPageDoc = New-Object System.Xml.XmlDocument
9 | $schema = $Null
10 | Function Start-ONApp {
11 | [CmdletBinding()]
12 | Param()
13 | if ( -not $script:onApp) {
14 | try {
15 | Write-Verbose "onApp not found"
16 | $interOp = Get-Item $env:WinDir\assembly\GAC_MSIL\Microsoft.Office.Interop.OneNote\15*\*
17 | Write-Verbose -Message "Interop Assembly found at: $($interOp.FullName)"
18 | Add-Type -LiteralPath $interOp.FullName
19 | # $script:onApp = New-Object -ComObject OneNote.Application
20 | $script:onApp = New-Object Microsoft.Office.Interop.OneNote.ApplicationClass
21 | }
22 | catch [System.Runtime.InteropServices.COMException] {
23 | Write-Error "Unable to create COM Object - is OneNote installed?"
24 | Break
25 | }
26 |
27 | $script:xmlNs = New-Object System.Xml.XmlNamespaceManager($xmlPageDoc.NameTable)
28 | $onProcess = Get-Process onenote
29 | $onVersion = $onProcess.ProductVersion.Split(".")
30 | Write-Verbose "OneNote version $($onVersion[0]) detected"
31 | #$onApp | Get-Member | Out-Host
32 | switch ($onVersion[0]) {
33 | "16" { $script:schema = "http://schemas.microsoft.com/office/onenote/2013/onenote" }
34 | "15" { $script:schema = "http://schemas.microsoft.com/office/onenote/2013/onenote" }
35 | "14" { $script:schema = "http://schemas.microsoft.com/office/onenote/2010/onenote" }
36 | }
37 | $xmlNs.AddNamespace("one",$schema)
38 | }
39 | else {
40 | Write-Verbose "onApp found"
41 | $message = $onApp.GetType()
42 | Write-Verbose $message
43 | }
44 | }
45 |
46 | Function Get-ONApp {
47 | Start-ONApp
48 | $ONApp
49 | }
50 | Function Get-ONHierarchy {
51 | Start-ONApp
52 | $onApp.getHierarchy($null,[Microsoft.Office.Interop.OneNote.HierarchyScope]::hsPages,[ref]$strPages)
53 | $xmlPageDoc.LoadXML($strPages)
54 | }
55 | Function Stop-ONApp {
56 | [System.Runtime.Interopservices.Marshal]::FinalReleaseComObject($onApp)
57 | $script:onApp = $Null
58 | #Remove-Variable onApp
59 | [GC]::Collect()
60 | }
61 | Function Get-ONNoteBooks {
62 | Start-ONApp
63 | $xmlNoteBooks = $xmlPageDoc.SelectNodes("//one:Notebook",$xmlNs)
64 | $xmlNoteBooks
65 | }
66 |
67 | Function Get-ONPages {
68 | [CmdletBinding(DefaultParameterSetName='All')]
69 | Param(
70 | [Parameter(ParameterSetName='NotebookName',Mandatory)]
71 | [String]$NoteBookName,
72 | [Parameter(ParameterSetName='NotebookId',Mandatory)]
73 | [String]$NoteBookId,
74 | [Parameter(ParameterSetName='SectionName',Mandatory)]
75 | [String]$SectionName,
76 | [Parameter(ParameterSetName='SectionId',Mandatory)]
77 | [String]$SectionId
78 | )
79 | Start-ONApp
80 | Write-Verbose $PSCmdlet.ParameterSetName
81 | switch ($PSCmdlet.ParameterSetName) {
82 | "NotebookName" { $xpath = "//one:Notebook[@name='$NotebookName']//one:Page"}
83 | "NotebookId" { $xpath = "//one:Notebook[@ID='$NotebookId']//one:Page"}
84 | "SectionName" { $xpath = "//one:Section[@name='$SectionName']/one:Page"}
85 | "SectionId" { $xpath = "//one:Section[@ID='$SectionId']/one:Page"}
86 | "All" { $xpath = "//one:Page" }
87 | }
88 | Write-Verbose $xpath
89 | $xmlPages = $xmlPageDoc.SelectNodes($xpath,$xmlNS)
90 | $xmlPages
91 | }
92 |
93 | Function Get-ONSectionGroups {
94 | [CmdletBinding(DefaultParameterSetName='All')]
95 | Param(
96 | [Parameter(ParameterSetName='NotebookName',Mandatory)]
97 | [String]$NoteBookName,
98 | [Parameter(ParameterSetName='NotebookId',Mandatory)]
99 | [String]$NoteBookId
100 | )
101 | Start-ONApp
102 | Write-Verbose $PSCmdlet.ParameterSetName
103 | switch ($PSCmdlet.ParameterSetName) {
104 | "NotebookName" { $xpath = "//one:Notebook[@name='$NotebookName']/one:SectionGroup[not(@isRecycleBin='true')]"}
105 | "NotebookId" { $xpath = "//one:Notebook[@ID='$NotebookId']/one:SectionGroup[not(@isRecycleBin='true')]"}
106 | "All" { $xpath = "//one:SectionGroup[not(@isRecycleBin='true')]" }
107 | }
108 | Write-Verbose $xpath
109 | $xmlSectionGroups = $xmlPageDoc.SelectNodes($xpath,$xmlNS)
110 | $xmlSectionGroups
111 | }
112 |
113 | Function Get-ONSections {
114 | [CmdletBinding(DefaultParameterSetName='All')]
115 | Param(
116 | [Parameter(ParameterSetName='NotebookName',Mandatory)]
117 | [String]$NoteBookName,
118 | [Parameter(ParameterSetName='NotebookId',Mandatory)]
119 | [String]$NoteBookId
120 | )
121 | Start-ONApp
122 | Write-Verbose $PSCmdlet.ParameterSetName
123 | switch ($PSCmdlet.ParameterSetName) {
124 | "NotebookName" { $xpath = "//one:Notebook[@name='$NotebookName']/one:Section"}
125 | "NotebookId" { $xpath = "//one:Notebook[@ID='$NotebookId']/one:Section"}
126 | "All" { $xpath = "//one:Section" }
127 | }
128 | Write-Verbose $xpath
129 | $xmlSections = $xmlPageDoc.SelectNodes($xpath,$xmlNS)
130 | $xmlSections
131 | }
132 | Function Get-ONSection {
133 | [CmdletBinding(DefaultParameterSetName='Name')]
134 | Param
135 | (
136 | [Parameter(Mandatory=$True,
137 | ValueFromPipeline=$True,
138 | ValueFromPipelineByPropertyName=$True,
139 | HelpMessage='Section Name?',ParameterSetName='Name')]
140 | [Alias('Name')]
141 | [string[]]$Section,
142 | [Parameter(Mandatory=$True,
143 | ValueFromPipeline=$True,
144 | ValueFromPipelineByPropertyName=$True,
145 | HelpMessage='Section Id?',ParameterSetName='Id')]
146 | [string[]]$Id
147 | )
148 | Start-ONApp
149 | $xpathList = @()
150 | Write-Verbose $PSCmdlet.ParameterSetName
151 | switch ($PSCmdlet.ParameterSetName) {
152 | 'Name' {
153 | foreach ($s in $Section ) { $xpathList += "//one:Section[@name='$s']" }
154 | }
155 | 'Id' {
156 | foreach ($i in $Id) { $xpathList += "//one:Section[@ID='$i']" }
157 | }
158 | }
159 | foreach ($xpath in $xpathList) {
160 | Write-Verbose $PSCmdlet.ParameterSetName
161 | $xmlSection = $xmlPageDoc.SelectSingleNode("$xpath",$xmlNs)
162 | $xmlSection
163 | }
164 | }
165 | Function New-ONPage {
166 | [CmdletBinding()]
167 | Param
168 | (
169 | [Parameter(Mandatory=$True,
170 | ValueFromPipeline=$True,
171 | ValueFromPipelineByPropertyName=$True,
172 | HelpMessage='Section ID?')]
173 | [Alias('id')]
174 | [string[]]$SectionID,
175 | [Alias('name')]
176 | [string]$Title
177 | )
178 | Begin {
179 | Start-ONApp
180 | $strPage = ''
181 | }
182 | Process {
183 | $onApp.createNewPage($SectionID,[ref]$pageID)
184 | $onApp.getPageContent($pageID,[ref]$strPage)
185 | $xmlNewPage.LoadXML($strPage)
186 | if ($Title) {
187 | $xmlNewPage.Page.Title.OE.T.InnerText = $Title
188 | }
189 | $xmlNewPage.Page
190 | }
191 | }
192 |
193 | Function Get-ONNoteBook {
194 | [CmdletBinding(DefaultParameterSetName='Name')]
195 | Param
196 | (
197 | [Parameter(Mandatory=$True,
198 | ValueFromPipeline=$True,
199 | ValueFromPipelineByPropertyName=$True,
200 | HelpMessage='Notebook Name?',ParameterSetName='Name')]
201 | [Alias('Name')]
202 | [string[]]$NoteBook,
203 | [Parameter(Mandatory=$True,
204 | ValueFromPipeline=$True,
205 | ValueFromPipelineByPropertyName=$True,
206 | HelpMessage='Notebook ID?',ParameterSetName='Id')]
207 | [string[]]$Id
208 | )
209 | Start-ONApp
210 | switch ($PSCmdlet.ParameterSetName) {
211 | 'Name' { $xpath = "//one:Notebook[@name='$Notebook']"}
212 | 'Id' { $xpath = "//one:Notebook[@ID='$Id']"}
213 | }
214 | $xmlNoteBook = $xmlPageDoc.SelectSingleNode("$xpath",$xmlNs)
215 | $xmlNoteBook
216 | }
217 | Function Add-ONElement {
218 | [CmdletBinding()]
219 | Param(
220 | [Parameter(Mandatory=$true,Position=1)]$Element,
221 | [Parameter(Mandatory=$true,Position=2)]$Parent
222 | )
223 | Start-ONApp
224 | $Parent.AppendChild($Element)
225 | }
226 | Function New-ONElement {
227 | [CmdletBinding()]
228 | Param(
229 | [Parameter(Mandatory=$true,Position=1)]$Element,
230 | [Parameter(Mandatory=$true,Position=2)]$Document
231 | )
232 | Start-ONApp
233 | $Document.OwnerDocument.CreateNode([system.xml.xmlnodetype]::Element,"one:$Element",$schema)
234 | }
235 | Function New-ONCData {
236 | [CmdletBinding()]
237 | Param(
238 | [Parameter(Mandatory=$true,Position=1)]$CData,
239 | [Parameter(Mandatory=$true,Position=2)]$Document
240 | )
241 | Start-ONApp
242 | $Document.OwnerDocument.CreateNode([system.xml.xmlnodetype]::CDATA,$CData,$schema)
243 | }
244 | Function Update-ONPage {
245 | [CmdletBinding()]
246 | Param
247 | (
248 | [Parameter(Mandatory=$True,
249 | ValueFromPipeline=$True,
250 | ValueFromPipelineByPropertyName=$True)]
251 | $PageContent
252 | )
253 | Begin {
254 | Start-ONApp
255 | }
256 | Process {
257 | Write-Verbose $PageContent.GetType().Name
258 | if ($PageContent.GetType().Name -eq 'XmlElement' ) {
259 | $PageContent = $PageContent.OuterXml
260 | Write-Verbose $PageContent
261 | }
262 | $onApp.UpdatePageContent($PageContent)
263 | Get-ONHierarchy
264 | }
265 | }
266 | Function Get-ONPage {
267 | [CmdletBinding(DefaultParameterSetName='Name')]
268 | Param
269 | (
270 | [Parameter(Mandatory=$True,
271 | ValueFromPipeline=$True,
272 | ValueFromPipelineByPropertyName=$True,
273 | HelpMessage='Page Name?',ParameterSetName='Name')]
274 | [Alias('Name')]
275 | [string[]]$Page,
276 | [Parameter(Mandatory=$True,
277 | ValueFromPipeline=$True,
278 | ValueFromPipelineByPropertyName=$True,
279 | HelpMessage='Page ID?',ParameterSetName='Id')]
280 | [string[]]$Id
281 | )
282 | Begin {
283 | Start-ONApp
284 | }
285 | Process {
286 | $xpathlist = @()
287 | $strPageContent=''
288 | Write-Verbose $PSCmdlet.ParameterSetName
289 | switch ($PSCmdlet.ParameterSetName) {
290 | 'Name' {
291 | foreach ($p in $Page ) { $xpathlist += "//one:Page[@name='$p'" }
292 | }
293 | 'Id' {
294 | foreach ($i in $Id) { $xpathlist += "//one:Page[@ID='$i'" }
295 | }
296 | }
297 | foreach ($xpath in $xpathlist) {
298 | $onPage = $xmlPageDoc.SelectSingleNode("$xpath and (@isInRecycleBin!='true' or not (@isInRecycleBin))]",$xmlNs)
299 | # Write-Verbose $onPage.OuterXml
300 | if ($onPage) {
301 | $onApp.GetPageContent($onPage.id,[ref]$strPageContent)
302 | $xmlPage.LoadXML($strPageContent)
303 | $xmlPage.Page
304 | }
305 | }
306 | }
307 | }
308 | Function Show-OnPage {
309 | [CmdletBinding(DefaultParameterSetName='Name')]
310 | Param (
311 | [Parameter(Mandatory=$True,
312 | ValueFromPipeline=$True,
313 | ValueFromPipelineByPropertyName=$True,
314 | HelpMessage='Page Name?',
315 | Position=0,
316 | ParameterSetName='Name')]
317 | [string]$Name,
318 | [Parameter(Mandatory=$True,
319 | ValueFromPipeline=$True,
320 | ValueFromPipelineByPropertyName=$True,
321 | HelpMessage='Page Id?',
322 | ParameterSetName='Id')]
323 | [string]$Id,
324 | [Parameter(ParameterSetName='Name')]
325 | [Parameter(ParameterSetName='Id')]
326 | [switch]$NewWindow
327 | )
328 | switch ($PSCmdlet.ParameterSetName) {
329 | "Name" { $navPage = Get-ONPage -Page $Name}
330 | "Id" { $NavPage = Get-ONPage -Id $Id }
331 | }
332 | if ($NewWindow.IsPresent) {
333 | $WindowFlag = -1
334 | }
335 | else {
336 | $WindowFlag = 0
337 | }
338 | $onApp.NavigateTo($navPage.id,$Null,$WindowFlag)
339 | }
340 |
341 | Function Show-ONGUI {
342 | [CmdletBinding()]
343 | Param()
344 | Start-ONApp
345 | $onApp.NavigateTo($Null)
346 | }
347 |
348 | Function Publish-ONObject {
349 | [CmdletBinding()]
350 | Param (
351 | [Parameter(Mandatory=$True,
352 | ValueFromPipeline=$True,
353 | ValueFromPipelineByPropertyName=$True,
354 | HelpMessage='Please provide a OneNote object ID')]
355 | [Alias('Identity')]
356 | [string[]]$Id,
357 | [Parameter(Mandatory=$True,
358 | HelpMessage='Please provide a valid OneNote export type')]
359 | [ValidateSet("PDF","XPS","DOC","EMF","ONEPKG","MHT","HTML")]
360 | [Alias('Type')]
361 | [string[]]$Format,
362 | [Parameter(Mandatory=$True,
363 | HelpMessage='Please provide a file path')]
364 | [Alias('FilePath')]
365 | [string[]]$Path
366 | )
367 | switch ($Format.ToLower()) {
368 | "onepkg" {$PublishFormat = 1;break}
369 | "mht" {$PublishFormat = 2;break}
370 | "pdf" {$PublishFormat = 3;break}
371 | "xps" {$PublishFormat = 4;break}
372 | "doc" {$PublishFormat = 5;break}
373 | "emf" {$PublishFormat = 6;break}
374 | "html" {$PublishFormat = 7;break}
375 | default {$PublishFormat = -1;break}
376 | }
377 | Write-Verbose $PublishFormat
378 | if ($PublishFormat -ge 0) {
379 | $onApp.Publish($Id,$Path,$PublishFormat,"")
380 | }
381 | }
382 | Get-ONHierarchy
383 | <#
384 | #Get-ONNoteBooks |gm
385 | $myNoteBook = Get-ONNoteBook -NoteBook "Stuart's Notebook"
386 | $myNoteBook
387 | #Get-ONPages | Select Name
388 | #Get-ONPage -Page "The Trouble with Tablets" | Select *
389 | #Get-ONPages | Where-Object {$_.Name -like '*tablet*'} | Get-ONPage | Get-Member
390 | $myPage = Get-ONPages | Where-Object {$_.Name -like '*tablet*'} | Get-ONPage
391 | $myPage
392 | #>
393 |
--------------------------------------------------------------------------------
/OneNoteUtilities/en-US/OneNoteUtilities-help.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Add-ONElement
6 | Add
7 | ONElement
8 |
9 | Adds a OneNote XML Schema element as a child of another
10 |
11 |
12 |
13 | Adds an already created OneNote XML Schema element as a child of another - using the XML DOM AppendChild method. Note that no explicit checking of validity of the resulting XML is undertaken.
14 |
15 |
16 |
17 | Add-ONElement
18 |
19 | Element
20 |
21 | The OneNote Schema element to add.
22 |
23 | Object
24 |
25 | Object
26 |
27 |
28 | None
29 |
30 |
31 | Parent
32 |
33 | The parent object in the OneNote hierarchy to which the new element will be added as a child.
34 |
35 | Object
36 |
37 | Object
38 |
39 |
40 | None
41 |
42 |
43 |
44 |
45 |
46 | Element
47 |
48 | The OneNote Schema element to add.
49 |
50 | Object
51 |
52 | Object
53 |
54 |
55 | None
56 |
57 |
58 | Parent
59 |
60 | The parent object in the OneNote hierarchy to which the new element will be added as a child.
61 |
62 | Object
63 |
64 | Object
65 |
66 |
67 | None
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | -------------------------- EXAMPLE 1 --------------------------
80 | $myPage = Get-ONPage -Page 'Amazon.co.uk - Stuart'
81 | $myOutline = New-ONElement -Element "Outline" -Document $myPage
82 | $myOEChildren = New-ONElement -Element "OEChildren" -Document $myPage
83 | $myOE = New-ONElement -Element "OE" -Document $myPage
84 | $myT = New-ONElement -Element "T" -Document $myPage
85 | $myT.InnerText = "Hello There yyyxxxxxyyy !"
86 | Add-ONElement -Element $myT -Parent $myOE
87 | Add-ONElement -Element $myOE -Parent $myOEChildren
88 | Add-ONElement -Element $myOEChildren -Parent $myOutline
89 | Add-ONElement -Element $myOutLine -Parent $myPage
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 | Get-ONHierarchy
100 | Get
101 | ONHierarchy
102 |
103 | Gets the current OneNote Hierarchy
104 |
105 |
106 |
107 | Loads the current OneNote Hierarchy for use by other functions. Use this command to ensure you are working with the current XML structure.
108 |
109 |
110 |
111 | Get-ONHierarchy
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 | -------------------------- EXAMPLE 1 --------------------------
125 | Get-ONHierarchy
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 | Get-ONNoteBook
136 | Get
137 | ONNoteBook
138 |
139 | Gets one or more OneNote Notebooks.
140 |
141 |
142 |
143 | Returns one or more OneNote XML Schema based elements representing specific Notebooks.
144 |
145 |
146 |
147 | Get-ONNoteBook
148 |
149 | Id
150 |
151 | The Notebook ID to query.
152 |
153 | String[]
154 |
155 | String[]
156 |
157 |
158 | None
159 |
160 |
161 |
162 | Get-ONNoteBook
163 |
164 | NoteBook
165 |
166 | The Notebook name to query.
167 |
168 | String[]
169 |
170 | String[]
171 |
172 |
173 | None
174 |
175 |
176 |
177 |
178 |
179 | Id
180 |
181 | The Notebook ID to query.
182 |
183 | String[]
184 |
185 | String[]
186 |
187 |
188 | None
189 |
190 |
191 | NoteBook
192 |
193 | The Notebook name to query.
194 |
195 | String[]
196 |
197 | String[]
198 |
199 |
200 | None
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 | -------------------------- EXAMPLE 1 --------------------------
213 | Get-ONNoteBook -NoteBook 'My NoteBook'
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 | Get-ONNoteBooks
224 | Get
225 | ONNoteBooks
226 |
227 | Gets OneNote Notebooks
228 |
229 |
230 |
231 | Returns OneNote XML Schema based elements representing Notebooks
232 |
233 |
234 |
235 | Get-ONNoteBooks
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 | -------------------------- EXAMPLE 1 --------------------------
249 | Get-ONNoteBooks
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 | Get-ONPage
260 | Get
261 | ONPage
262 |
263 | Gets a OneNote Page.
264 |
265 |
266 |
267 | Returns OneNote XML Schema based element representing a specific Page. Ignores pages in the recycle bin.
268 |
269 |
270 |
271 | Get-ONPage
272 |
273 | Id
274 |
275 | Page Id?
276 |
277 | String[]
278 |
279 | String[]
280 |
281 |
282 | None
283 |
284 |
285 |
286 | Get-ONPage
287 |
288 | Page
289 |
290 | What Page?
291 |
292 | String[]
293 |
294 | String[]
295 |
296 |
297 | None
298 |
299 |
300 |
301 |
302 |
303 | Id
304 |
305 | Page Id?
306 |
307 | String[]
308 |
309 | String[]
310 |
311 |
312 | None
313 |
314 |
315 | Page
316 |
317 | What Page?
318 |
319 | String[]
320 |
321 | String[]
322 |
323 |
324 | None
325 |
326 |
327 |
328 |
329 |
330 | System.Object
331 |
332 |
333 | Any object with a Page or Name property.
334 |
335 |
336 |
337 |
338 |
339 |
340 | System.Xml.XmlElement
341 |
342 |
343 | Extended by the currently selected OneNote schema. This includes the full content of the page, unlike the objects returned by the Get-ONPages command.
344 |
345 |
346 |
347 |
348 |
349 | This function uses the XPath SelectSingleNode method 'under the hood'. This means: In the event of multiple pages having the same name, only the first will be returned. The page search is case-sensitive.
350 |
351 |
352 |
353 |
354 | -------------------------- EXAMPLE 1 --------------------------
355 | Get-ONPage -Page "My Page"
356 |
357 | This example returns a Page XmlElement object representing the page with the exact name "My Page".
358 |
359 |
360 |
361 | -------------------------- EXAMPLE 2 --------------------------
362 | Get-ONPages | Where-Object { $_.Name -like 'OneNote*' } | Get-ONPage
363 |
364 | This example uses the Get-ONPages command and standard PowerShell filtering to pass objects to Get-ONPage via the pipeline. Get-ONPage then returns a Page XmlElement object for each object received.
365 |
366 |
367 |
368 | -------------------------- EXAMPLE 3 --------------------------
369 | Get-Service | Where-Object { $_.Name -like '*winrm*' } | Get-ONPage
370 |
371 | one : http://schemas.microsoft.com/office/onenote/2013/onenote
372 | ID : {D7B35AD3-1559-0CBB-0F63-F10786864060}{1}{E19476877483600779377920100891604390372276781}
373 | name : WinRM
374 | dateTime : 2016-06-25T14:28:56.000Z
375 | lastModifiedTime : 2016-06-25T14:30:28.000Z
376 | pageLevel : 1
377 | lang : en-GB
378 | QuickStyleDef : {PageTitle, p}
379 | PageSettings : PageSettings
380 | Title : Title
381 | Outline : Outline
382 |
383 | This example returns a Page XmlElement that whose name matches that of the object passed down the pipeline.
384 |
385 |
386 |
387 | -------------------------- EXAMPLE 4 --------------------------
388 | Get-ONPage -id '{AB5DB915-FB77-0D89-1B94-8D316660CFCB}{1}{E1910021276453986493171911072997640903877411}'
389 |
390 | one : http://schemas.microsoft.com/office/onenote/2013/onenote
391 | ID : {AB5DB915-FB77-0D89-1B94-8D316660CFCB}{1}{E1910021276453986493171911072997640903877411}
392 | name : Article list
393 | dateTime : 2017-04-15T11:41:36.000Z
394 | lastModifiedTime : 2017-08-24T13:00:13.000Z
395 | pageLevel : 1
396 | lang : en-GB
397 | QuickStyleDef : {PageTitle, p}
398 | PageSettings : PageSettings
399 | Title : Title
400 | Outline : Outline
401 |
402 | This example returns a page based on its ID.
403 |
404 |
405 |
406 |
407 |
408 | Get-ONPages
409 |
410 |
411 |
412 |
413 |
414 |
415 | Get-ONPages
416 | Get
417 | ONPages
418 |
419 | Gets OneNote Pages
420 |
421 |
422 |
423 | Returns OneNote XML Schema based elements representing Pages. By default, all Pages from all Notebooks are returned and can be filtered using standard cmdlets like Where-Object. As an alternative you can specify the names or IDs of the Notebook or Section hosting the Pages.
424 |
425 |
426 |
427 | Get-ONPages
428 |
429 | NoteBookId
430 |
431 | The ID of the Notebook hosting the pages.
432 |
433 | String
434 |
435 | String
436 |
437 |
438 | None
439 |
440 |
441 |
442 | Get-ONPages
443 |
444 | NoteBookName
445 |
446 | The name of the Notebook hosting the pages.
447 |
448 | String
449 |
450 | String
451 |
452 |
453 | None
454 |
455 |
456 |
457 | Get-ONPages
458 |
459 | SectionId
460 |
461 | The ID of the Section hosting the pages.
462 |
463 | String
464 |
465 | String
466 |
467 |
468 | None
469 |
470 |
471 |
472 | Get-ONPages
473 |
474 | SectionName
475 |
476 | The name of the Section hosting the pages.
477 |
478 | String
479 |
480 | String
481 |
482 |
483 | None
484 |
485 |
486 |
487 |
488 |
489 | NoteBookId
490 |
491 | The ID of the Notebook hosting the pages.
492 |
493 | String
494 |
495 | String
496 |
497 |
498 | None
499 |
500 |
501 | NoteBookName
502 |
503 | The name of the Notebook hosting the pages.
504 |
505 | String
506 |
507 | String
508 |
509 |
510 | None
511 |
512 |
513 | SectionId
514 |
515 | The ID of the Section hosting the pages.
516 |
517 | String
518 |
519 | String
520 |
521 |
522 | None
523 |
524 |
525 | SectionName
526 |
527 | The name of the Section hosting the pages.
528 |
529 | String
530 |
531 | String
532 |
533 |
534 | None
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 | -------------------------- EXAMPLE 1 --------------------------
547 | Get-ONPages
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 | Get-ONSection
558 | Get
559 | ONSection
560 |
561 | Gets one or more OneNote Sections
562 |
563 |
564 |
565 | Returns OneNote XML Schema based elements representing one or more Sections.
566 |
567 |
568 |
569 | Get-ONSection
570 |
571 | Id
572 |
573 | Section Id?
574 |
575 | String[]
576 |
577 | String[]
578 |
579 |
580 | None
581 |
582 |
583 |
584 | Get-ONSection
585 |
586 | Section
587 |
588 | The Section name to query. Just one.
589 |
590 | String[]
591 |
592 | String[]
593 |
594 |
595 | None
596 |
597 |
598 |
599 |
600 |
601 | Id
602 |
603 | Section Id?
604 |
605 | String[]
606 |
607 | String[]
608 |
609 |
610 | None
611 |
612 |
613 | Section
614 |
615 | The Section name to query. Just one.
616 |
617 | String[]
618 |
619 | String[]
620 |
621 |
622 | None
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 | -------------------------- Example 1 --------------------------
635 | PS C:\> Get-ONSection -Section 'Teacher Notes','Administration Notes'
636 |
637 | name : Teacher Notes
638 | ID : {1DE00420-3700-037A-3F54-97489F626533}{20}{B0}
639 | path : https://d.docs.live.net/816f7725bef99999/Documents/Real World Samples/Teacher Notes.one
640 | lastModifiedTime : 2020-03-25T19:31:50.000Z
641 | color : #9595AA
642 | isUnread : true
643 | Page : {7th Grade Math, 1.10 - The Coordinate Plane, 1.2 - Variables and Expressions, Problem-Solving...}
644 |
645 | name : Administration Notes
646 | ID : {BACECC72-6805-0656-22E9-319A25A5247A}{22}{B0}
647 | path : https://d.docs.live.net/816f7725bef99999/Documents/Real World Samples/Administration Notes.one
648 | lastModifiedTime : 2019-01-30T11:08:41.000Z
649 | color : #B7C997
650 | Page : {Staff and Faculty Notes examples, Calendars, Schedule and Academic Calendar, Fall Sports...}
651 |
652 | This command returns the two Sections specified by name.
653 |
654 |
655 |
656 | -------------------------- Example 2 --------------------------
657 | PS C:\> Get-ONSection -Id '{70863F49-36D4-0CB0-1CBD-AF8C35E05883}{29}{B0}'
658 |
659 | name : Lesson Plans
660 | ID : {70863F49-36D4-0CB0-1CBD-AF8C35E05883}{29}{B0}
661 | path : https://d.docs.live.net/816f7725bef99999/Documents/Real World Samples/Lesson Plans.one
662 | lastModifiedTime : 2020-03-25T19:31:49.000Z
663 | color : #D5A4BB
664 | Page : {3rd Grade Math, Egyptian numbers - Handout #2, Number System in China - Handout #8, Trace the Graph...}
665 |
666 | This command returns the Section specified by the Id.
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 | Get-ONSectionGroups
675 | Get
676 | ONSectionGroups
677 |
678 | Gets OneNote Section Groups.
679 |
680 |
681 |
682 | Returns OneNote XML Schema based elements representing Section Groups.
683 |
684 |
685 |
686 | Get-ONSectionGroups
687 |
688 | NoteBookId
689 |
690 | The ID of the Notebook containing the Section Groups.
691 |
692 | String
693 |
694 | String
695 |
696 |
697 | None
698 |
699 |
700 |
701 | Get-ONSectionGroups
702 |
703 | NoteBookName
704 |
705 | The name of the Notebook containg the Section Groups.
706 |
707 | String
708 |
709 | String
710 |
711 |
712 | None
713 |
714 |
715 |
716 |
717 |
718 | NoteBookId
719 |
720 | The ID of the Notebook containing the Section Groups.
721 |
722 | String
723 |
724 | String
725 |
726 |
727 | None
728 |
729 |
730 | NoteBookName
731 |
732 | The name of the Notebook containg the Section Groups.
733 |
734 | String
735 |
736 | String
737 |
738 |
739 | None
740 |
741 |
742 |
743 |
744 |
745 | None
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 | System.Object
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 | -------------------------- Example 1 --------------------------
770 | PS C:\> Get-SectionGroups
771 |
772 | This command returns all Section Groups in all Notebooks.
773 |
774 |
775 |
776 | -------------------------- Example 2 --------------------------
777 | PS C:\> Get-ONSectionGroups -NoteBookName 'WebNotes'
778 |
779 | name : First Section Group
780 | ID : {1F3C5AB9-BEDB-49AE-8FFE-C0EEB19817D5}{1}{B0}
781 | path : https://d.docs.live.net/816f7725bef99999/WebNotes/First Section Group/
782 | lastModifiedTime : 2020-03-28T11:44:42.000Z
783 | Section : Section
784 |
785 | This command returns all Section Groups in the specified Notebook
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 | Get-ONSections
794 | Get
795 | ONSections
796 |
797 | Gets OneNote Sections
798 |
799 |
800 |
801 | Returns OneNote XML Schema based elements representing Sections. By default, all Sections from all Notebooks are returned and can be filtered using standard cmdlets like Where-Object. As an alternative you can specify the names or IDs of the Notebook hosting the Sections.
802 |
803 |
804 |
805 | Get-ONSections
806 |
807 | NoteBookId
808 |
809 | The ID of the Notebook hosting the Sections.
810 |
811 | String
812 |
813 | String
814 |
815 |
816 | None
817 |
818 |
819 |
820 | Get-ONSections
821 |
822 | NoteBookName
823 |
824 | The name of the Notebook hosting the Sections.
825 |
826 | String
827 |
828 | String
829 |
830 |
831 | None
832 |
833 |
834 |
835 |
836 |
837 | NoteBookId
838 |
839 | The ID of the Notebook hosting the Sections.
840 |
841 | String
842 |
843 | String
844 |
845 |
846 | None
847 |
848 |
849 | NoteBookName
850 |
851 | The name of the Notebook hosting the Sections.
852 |
853 | String
854 |
855 | String
856 |
857 |
858 | None
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 | -------------------------- EXAMPLE 1 --------------------------
871 | Get-ONSections
872 |
873 | This command returns all Sections in all Notebooks
874 |
875 |
876 |
877 | -------------------------- EXAMPLE 2 --------------------------
878 | Get-ONSections -NoteBookName 'Real World Samples'
879 |
880 | name : Student pages
881 | ID : {C19F5E9B-C37B-0C25-0FC7-55FCE4E36F7B}{26}{B0}
882 | path : https://d.docs.live.net/816f7725bef00a5f/Documents/Real World Samples/Student pages.one
883 | lastModifiedTime : 2019-07-16T15:03:46.000Z
884 | color : #8AA8E4
885 | Page : {Cincinnati Country Day School samples, Graphing/Color Coding , Forces, Gravity, and Newton's Laws of M6otion, La Religión...}
886 |
887 | name : Lesson Plans
888 | ID : {70863F49-36D4-0CB0-1CBD-AF8C35E05883}{29}{B0}
889 | path : https://d.docs.live.net/816f7725bef00a5f/Documents/Real World Samples/Lesson Plans.one
890 | lastModifiedTime : 2020-03-25T19:31:49.000Z
891 | color : #D5A4BB
892 | Page : {3rd Grade Math, Egyptian numbers - Handout #2, Number System in China - Handout #8, Trace the Graph...}
893 | ...
894 |
895 | This command returns all of the sections from the named Notebook.
896 |
897 |
898 |
899 |
900 |
901 |
902 |
903 | New-ONElement
904 | New
905 | ONElement
906 |
907 | Creates a OneNote XML Schema based element
908 |
909 |
910 |
911 | Creates an element of the specified type in the specified XML document's DOM using the currently in-use schema.
912 |
913 |
914 |
915 | New-ONElement
916 |
917 | Element
918 |
919 | The tag name of the new element.
920 |
921 | Object
922 |
923 | Object
924 |
925 |
926 | None
927 |
928 |
929 | Document
930 |
931 | The XML Document object (OneNote Page) to host the new element.
932 |
933 | Object
934 |
935 | Object
936 |
937 |
938 | None
939 |
940 |
941 |
942 |
943 |
944 | Document
945 |
946 | The XML Document object (OneNote Page) to host the new element.
947 |
948 | Object
949 |
950 | Object
951 |
952 |
953 | None
954 |
955 |
956 | Element
957 |
958 | The tag name of the new element.
959 |
960 | Object
961 |
962 | Object
963 |
964 |
965 | None
966 |
967 |
968 |
969 |
970 |
971 |
972 |
973 |
974 |
975 |
976 |
977 | -------------------------- EXAMPLE 1 --------------------------
978 | New-ONElement -Element "T" -Document $XMLDoc
979 |
980 |
981 |
982 |
983 |
984 | -------------------------- EXAMPLE 2 --------------------------
985 | $myPage = Get-ONPage -Page 'Amazon.co.uk - Stuart'
986 |
987 | $myOutline = New-ONElement -Element "Outline" -Document $myPage $myOEChildren = New-ONElement -Element "OEChildren" -Document $myPage $myOE = New-ONElement -Element "OE" -Document $myPage $myT = New-ONElement -Element "T" -Document $myPage $myT.InnerText = "Hello There yyyxxxxxyyy !" Add-ONElement -Element $myT -Parent $myOE Add-ONElement -Element $myOE -Parent $myOEChildren Add-ONElement -Element $myOEChildren -Parent $myOutline Add-ONElement -Element $myOutLine -Parent $myPage Update-ONPage $myPage.OuterXML
988 |
989 |
990 |
991 |
992 |
993 |
994 |
995 | New-ONPage
996 | New
997 | ONPage
998 |
999 | Create a new OneNote Page.
1000 |
1001 |
1002 |
1003 | Returns a OneNote XML Schema based element representing the new page.
1004 |
1005 |
1006 |
1007 | New-ONPage
1008 |
1009 | SectionID
1010 |
1011 | The ID of the Section in which the Page is to be created.
1012 |
1013 | String[]
1014 |
1015 | String[]
1016 |
1017 |
1018 | None
1019 |
1020 |
1021 | Title
1022 |
1023 | The title of the new Page.
1024 |
1025 | String
1026 |
1027 | String
1028 |
1029 |
1030 | None
1031 |
1032 |
1033 |
1034 |
1035 |
1036 | SectionID
1037 |
1038 | The ID of the Section in which the Page is to be created.
1039 |
1040 | String[]
1041 |
1042 | String[]
1043 |
1044 |
1045 | None
1046 |
1047 |
1048 | Title
1049 |
1050 | The title of the new Page.
1051 |
1052 | String
1053 |
1054 | String
1055 |
1056 |
1057 | None
1058 |
1059 |
1060 |
1061 |
1062 |
1063 | Any object with an 'id' property
1064 |
1065 |
1066 |
1067 |
1068 |
1069 |
1070 |
1071 |
1072 |
1073 | System.Xml.XmlElement extended by the currently selected OneNote schema.
1074 |
1075 |
1076 |
1077 |
1078 |
1079 |
1080 |
1081 |
1082 |
1083 |
1084 |
1085 |
1086 |
1087 | -------------------------- EXAMPLE 1 --------------------------
1088 | Get-ONSections | Where-Object { $_.name -like '*unfiled*' } | New-ONPage
1089 |
1090 | xml Page
1091 | --- ----
1092 | version="1.0" Page
1093 |
1094 | This example uses the Get-ONSections command and standard PowerShell filtering to pass objects to New-ONPage via the pipeline. New-ONPage then returns a Page XmlElement object for each object received.
1095 |
1096 |
1097 |
1098 |
1099 |
1100 |
1101 |
1102 | Publish-ONObject
1103 | Publish
1104 | ONObject
1105 |
1106 | Publishes a OneNote page in an external file format.
1107 |
1108 |
1109 |
1110 | Publishes a OneNote page. Available formats are:
1111 | - MHTML files (.mht) - (OneNote 2013 or newer)
1112 | - Adobe Acrobat PDF files (.pdf)
1113 | - XML Paper Specification (XPS) files (.xps)
1114 | - OneNote Package files (.onepkg)
1115 | - Microsoft Word documents (.doc or .docx)
1116 | - Microsoft Windows Enhanced Metafiles (.emf)
1117 | - HTML files (.html)
1118 |
1119 |
1120 |
1121 | Publish-ONObject
1122 |
1123 | Id
1124 |
1125 | The Id of the OneNote page to be published.
1126 |
1127 | String[]
1128 |
1129 | String[]
1130 |
1131 |
1132 | None
1133 |
1134 |
1135 | Format
1136 |
1137 | One of the valid publishing file formats.
1138 |
1139 |
1140 | PDF
1141 | XPS
1142 | DOC
1143 | EMF
1144 | ONEPKG
1145 | MHT
1146 | HTML
1147 |
1148 | String[]
1149 |
1150 | String[]
1151 |
1152 |
1153 | None
1154 |
1155 |
1156 | Path
1157 |
1158 | The full path of the file to be created.
1159 |
1160 | String[]
1161 |
1162 | String[]
1163 |
1164 |
1165 | None
1166 |
1167 |
1168 |
1169 |
1170 |
1171 | Format
1172 |
1173 | One of the valid publishing file formats.
1174 |
1175 | String[]
1176 |
1177 | String[]
1178 |
1179 |
1180 | None
1181 |
1182 |
1183 | Id
1184 |
1185 | The Id of the OneNote page to be published.
1186 |
1187 | String[]
1188 |
1189 | String[]
1190 |
1191 |
1192 | None
1193 |
1194 |
1195 | Path
1196 |
1197 | The full path of the file to be created.
1198 |
1199 | String[]
1200 |
1201 | String[]
1202 |
1203 |
1204 | None
1205 |
1206 |
1207 |
1208 |
1209 |
1210 | System.String[]
1211 |
1212 |
1213 |
1214 |
1215 |
1216 |
1217 |
1218 |
1219 |
1220 | System.Object
1221 |
1222 |
1223 |
1224 |
1225 |
1226 |
1227 |
1228 |
1229 |
1230 |
1231 |
1232 |
1233 |
1234 | -------------------------- Example 1 --------------------------
1235 | PS C:\> Publish-ONObject -Id '{C19F5E9B-C37B-0C25-0FC7-55FCE4E36F7B}{26}{E18372038253285132566191417462735909894706105}' -Format PDF -Path C:\Users\User\Desktop\Chapter1.pdf
1236 |
1237 | This command creates a PDF version of the specified page at the specified location.
1238 |
1239 |
1240 |
1241 |
1242 |
1243 |
1244 |
1245 | Show-ONGUI
1246 | Show
1247 | ONGUI
1248 |
1249 | Show-ONGUI displays the OneNote Graphical User Interface focused on the default notebook.
1250 |
1251 |
1252 |
1253 | Show-ONGUI displays the OneNote Graphical User Interface focused on the default notebook. If the user interface is already visible then this command has no effect.
1254 |
1255 |
1256 |
1257 | Show-ONGUI
1258 |
1259 |
1260 |
1261 |
1262 |
1263 |
1264 | None
1265 |
1266 |
1267 |
1268 |
1269 |
1270 |
1271 |
1272 |
1273 |
1274 | System.Object
1275 |
1276 |
1277 |
1278 |
1279 |
1280 |
1281 |
1282 |
1283 | If you initiate your OneNote session in such a way that the user interface is not displayed, this is the best way to make the OneNote window visible.
1284 |
1285 |
1286 |
1287 |
1288 | -------------------------- Example 1 --------------------------
1289 | PS C:\> Show-ONGUI
1290 |
1291 | This example displays the OneNote GUI.
1292 |
1293 |
1294 |
1295 |
1296 |
1297 |
1298 |
1299 | Show-OnPage
1300 | Show
1301 | OnPage
1302 |
1303 | Displays a page in the OneNote user interface.
1304 |
1305 |
1306 |
1307 | Displays a page in the OneNote user interface.
1308 |
1309 |
1310 |
1311 | Show-OnPage
1312 |
1313 | Id
1314 |
1315 | Page Id?
1316 |
1317 | String
1318 |
1319 | String
1320 |
1321 |
1322 | None
1323 |
1324 |
1325 | NewWindow
1326 |
1327 | Displays the Page in a new OneNote window, instead of re-using an existing window if one exists.
1328 |
1329 |
1330 | SwitchParameter
1331 |
1332 |
1333 | False
1334 |
1335 |
1336 |
1337 | Show-OnPage
1338 |
1339 | Name
1340 |
1341 | Page Name?
1342 |
1343 | String
1344 |
1345 | String
1346 |
1347 |
1348 | None
1349 |
1350 |
1351 | NewWindow
1352 |
1353 | Displays the Page in a new OneNote window, instead of re-using an existing window if one exists.
1354 |
1355 |
1356 | SwitchParameter
1357 |
1358 |
1359 | False
1360 |
1361 |
1362 |
1363 |
1364 |
1365 | Id
1366 |
1367 | Page Id?
1368 |
1369 | String
1370 |
1371 | String
1372 |
1373 |
1374 | None
1375 |
1376 |
1377 | Name
1378 |
1379 | Page Name?
1380 |
1381 | String
1382 |
1383 | String
1384 |
1385 |
1386 | None
1387 |
1388 |
1389 | NewWindow
1390 |
1391 | Displays the Page in a new OneNote window, instead of re-using an existing window if one exists.
1392 |
1393 | SwitchParameter
1394 |
1395 | SwitchParameter
1396 |
1397 |
1398 | False
1399 |
1400 |
1401 |
1402 |
1403 |
1404 | System.String[]
1405 |
1406 |
1407 |
1408 |
1409 |
1410 |
1411 |
1412 |
1413 |
1414 | System.Object
1415 |
1416 |
1417 |
1418 |
1419 |
1420 |
1421 |
1422 |
1423 |
1424 |
1425 |
1426 |
1427 |
1428 | -------------------------- Example 1 --------------------------
1429 | PS C:\> Show-ONPage -Id '{C19F5E9B-C37B-0C25-0FC7-55FCE4E36F7B}{26}{E18372038253285132566191417462735909894706105}'
1430 |
1431 | This command displays the specified page in OneNote.
1432 |
1433 |
1434 |
1435 |
1436 |
1437 |
1438 |
1439 | Start-ONApp
1440 | Start
1441 | ONApp
1442 |
1443 | Starts the OneNote application if it is not already running.
1444 |
1445 |
1446 |
1447 | Starts the OneNote application if it is not already running. Returns a COM object for further use by the module.
1448 |
1449 |
1450 |
1451 | Start-ONApp
1452 |
1453 |
1454 |
1455 |
1456 |
1457 |
1458 | None
1459 |
1460 |
1461 |
1462 |
1463 |
1464 |
1465 |
1466 |
1467 |
1468 | System.Object
1469 |
1470 |
1471 |
1472 |
1473 |
1474 |
1475 |
1476 |
1477 |
1478 |
1479 |
1480 |
1481 |
1482 | -------------------------- Example 1 --------------------------
1483 | PS C:\> Start-ONApp
1484 |
1485 | This example starts the OneNote application.
1486 |
1487 |
1488 |
1489 |
1490 |
1491 |
1492 |
1493 | Stop-ONApp
1494 | Stop
1495 | ONApp
1496 |
1497 | Unloads the COM Object
1498 |
1499 |
1500 |
1501 | Unloads the COM Object
1502 |
1503 |
1504 |
1505 | Stop-ONApp
1506 |
1507 |
1508 |
1509 |
1510 |
1511 |
1512 |
1513 |
1514 |
1515 |
1516 |
1517 |
1518 | -------------------------- EXAMPLE 1 --------------------------
1519 | Stop-ONApp
1520 |
1521 |
1522 |
1523 |
1524 |
1525 |
1526 |
1527 |
1528 |
1529 | Update-ONPage
1530 | Update
1531 | ONPage
1532 |
1533 | Updates an existing OneNote page.
1534 |
1535 |
1536 |
1537 | Updates a OneNote page using the currently in-use schema. The cmdlet automatically checks if the object passed to the cmdlet is an XmlElement. If so, the OuterXML property is used.
1538 |
1539 |
1540 |
1541 | Update-ONPage
1542 |
1543 | PageContent
1544 |
1545 | An xml string containing the updated page content, or an XxmlElement object containing a OneNote page.
1546 |
1547 | Object
1548 |
1549 | Object
1550 |
1551 |
1552 | None
1553 |
1554 |
1555 |
1556 |
1557 |
1558 | PageContent
1559 |
1560 | An xml string containing the updated page content, or an XxmlElement object containing a OneNote page.
1561 |
1562 | Object
1563 |
1564 | Object
1565 |
1566 |
1567 | None
1568 |
1569 |
1570 |
1571 |
1572 |
1573 |
1574 |
1575 |
1576 |
1577 |
1578 |
1579 | -------------------------- EXAMPLE 1 --------------------------
1580 | Update-ONPage $myPage.OuterXML
1581 |
1582 | In this example the OuterXML property of a OneNote XML page object is passed to the Update-ONPage cmdlet.
1583 |
1584 |
1585 |
1586 | -------------------------- EXAMPLE 2 --------------------------
1587 | Update-ONPage $myPage
1588 |
1589 | In this example a OneNote XML page object is passed to the Update-ONPage cmdlet. The cmdlet automatically extracts the OuterXML property.
1590 |
1591 |
1592 |
1593 | -------------------------- EXAMPLE 3 --------------------------
1594 | $myPageXML = Get-ONPage -Page 'MyPage' | Select-Object OuterXML
1595 | Update-ONPage $myPage
1596 |
1597 | In this example a OneNote XML page's OuterXML property is passed to the Update-ONPage cmdlet.
1598 |
1599 |
1600 |
1601 |
1602 |
1603 |
--------------------------------------------------------------------------------
/OneNoteUtilities/en-US/about_OneNoteUtilities.help.txt:
--------------------------------------------------------------------------------
1 | TOPIC
2 | about_OneNoteUtilities
3 |
4 | SHORT DESCRIPTION
5 | A description of OneNoteUtilities and how it can be used
6 |
7 | LONG DESCRIPTION
8 | OneNoteUtilities is designed to be a bridge between the world of OneNote and the world
9 | of PowerShell. Using this module you can interrogate OneNote data, create or update new
10 | OneNote objects and control the OneNote User Interface
11 |
12 | EXAMPLES
13 | Get-Service | Where-Object { $_.Name -like '*winrm*' } | Get-ONPage
14 |
15 | one : http://schemas.microsoft.com/office/onenote/2013/onenote
16 | ID : {D7B35AD3-1559-0CBB-0F63-F10786864060}{1}{E19476877483600779377920100891604390372276781}
17 | name : WinRM
18 | dateTime : 2016-06-25T14:28:56.000Z
19 | lastModifiedTime : 2016-06-25T14:30:28.000Z
20 | pageLevel : 1
21 | lang : en-GB
22 | QuickStyleDef : {PageTitle, p}
23 | PageSettings : PageSettings
24 | Title : Title
25 | Outline : Outline
26 |
27 | KEYWORDS
28 | OneNoteUtilities
29 |
30 | SEE ALSO
31 | https://github.com/wightsci/OneNoteUtilities
32 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # OneNoteUtilities
2 | OneNoteUtilities PowerShell Module
3 | ----------------------------------
4 |
5 | A PowerShell module to interact with the desktop version of Microsoft OneNote.
6 |
7 | Development of this module continues following Microsoft's most recent announcement (November 2019):
8 |
9 | https://techcommunity.microsoft.com/t5/Office-365-Blog/Your-OneNote/ba-p/954922
10 |
11 | The current version is 1.0
12 |
13 | This module provides the following functions:
14 |
15 | * [Start-ONApp](docs/Start-ONApp.md)
16 | * [Stop-ONApp](docs/Stop-ONApp.md)
17 | * [Get-ONHierarchy](docs/Get-ONHierarchy.md)
18 | * [Get-ONNoteBook](docs/Get-ONNoteBook.md)
19 | * [Get-ONNoteBooks](docs/Get-ONNoteBooks.md)
20 | * [Get-ONPage](docs/Get-ONPage.md)
21 | * [Get-ONPages](docs/Get-ONPages.md)
22 | * [Get-ONSection](docs/Get-ONSection.md)
23 | * [Get-ONSections](docs/Get-ONSections.md)
24 | * [Get-ONSectionGroups](docs/Get-ONSectionGroups.md)
25 | * [New-ONElement](docs/New-ONElement.md)
26 | * [New-ONPage](docs/New-ONPage.md)
27 | * [Update-ONPage](docs/Update-ONPage.md)
28 | * [Show-ONPage](docs/Show-ONPage.md)
29 | * [Show-ONGUI](docs/Show-ONGUI.md)
30 | * [Add-ONElement](docs/Add-ONElement.md)
31 | * [Publish-ONObject](docs/Publish-ONObject.md)
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/docs/Add-ONElement.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: OneNoteUtilities-help.xml
3 | Module Name: OneNoteUtilities
4 | online version:
5 | schema: 2.0.0
6 | ---
7 |
8 | # Add-ONElement
9 |
10 | ## SYNOPSIS
11 | Adds a OneNote XML Schema element as a child of another
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Add-ONElement [-Element]