forked from sytone/OneNotePowerShellProvider
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabout_OneNote.help.txt
More file actions
151 lines (93 loc) · 3.96 KB
/
about_OneNote.help.txt
File metadata and controls
151 lines (93 loc) · 3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
PROVIDER NAME
Microsoft.Office.OneNote
DRIVES
OneNote:
SYNOPSIS
The PowerShell provider for manipulating OneNote notebooks.
DETAILED DESCRIPTION
The Windows PowerShell OneNote provider lets you create and
manipulate OneNote notebooks, sections, and pages. You can add
content to pages.
To have access to the OneNote provider, you should run the
Enable-OneNote script. This will add the provider snapin to your
PowerShell session and update the PowerShell formatting
information to do custom formatting of OneNote objects. You need
to run Enable-OneNote each time you start PowerShell, so it is a
good candidate to put in your profile.
TASKS
TASK: Navigate through your notebooks.
You can see your currently open notebooks by using the
OneNote: drive.
--------------- EXAMPLE 1 ---------------
dir OneNote:
TASK: Create notebook structure.
You can create notebooks, sections, and pages with the
new-item cmdlet.
--------------- EXAMPLE 1 ---------------
new-item -path onenote:\TempNotebook -type Notebook -value "$(gc env:\temp)"
new-item -path OneNote:\TempNotebook\Section -type section
new-item -path "OneNote:\TempNotebook\Section\Page 1" -type page
new-item -path "OneNote:\TempNotebook\Section\Page 2" -type page
new-item -path "OneNote:\TempNotebook\Section\Page 3" -type page
new-item -path "OneNote:\TempNotebook\Section 2" -type section
--------------- EXAMPLE 2 ---------------
Note that relative paths work, and you can abbreviate type
names.
pushd "OneNote:\TempNotebook\Section 2"
new-item -path ".\Page 1" -type p
new-item -path ".\Foobar" -type p
new-item -path ".\Razzle" -type p
new-item -path OneNote:\TempNotebook\Foo -type section
dir OneNote:\TempNotebook -recurse
popd
--------------- EXAMPLE 3 ---------------
Because forward slashes and back slashes are used as path
separators, and ':' is the drive separator, you need to escape
them when using them in the names of pages, sections, etc.
new-item -path "onenote:\tempnotebook\section\either/or" -type page
new-item -path "onenote:\tempNotebook\section\C:\Users\BDewey" -type page
TASK: Adding content to OneNote pages.
You can use the Add-Content and Set-Content cmdlets to add
content to OneNote pages.
--------------- EXAMPLE 1 ---------------
get-process | out-string | add-content "onenote:\TempNotebook\Section\Page 1"
--------------- EXAMPLE 2 ---------------
If you pipe FileInfo objects to add-content, then the file
will be embedded in the page.
dir $PSHome\Documents\EN-US\GettingStarted.rtf | add-content "OneNote:\TempNotebook\Section\Page 2"
CMDLETS SUPPORTED
The OneNote provider supports the following cmdlets.
New-Item
Creates new Notebooks, Sections, or Pages.
Clear-Item
Closes notebooks.
Add-Content
Adds string or FileInfo objects to notebook pages.
Set-Content
Deletes the existing content of a page and sets the page
content to the string or FileInfo object.
Get-Item
Gets the named OneNote item (Notebook, Section, SectionGroup,
or Page).
Get-ChildItem
Gets the children of a OneNote item.
Get-Content
Gets the XML representing a OneNote page.
Test-Path
Determines if the given string is a valid path to a OneNote
item.
Remove-Item
Deletes OneNote content.
NOTES
- The new-item cmdlet cannot create Section Groups.
- There is no way to access the OpenSections group.
RELATED LINKS
Enable-OneNote
Export-OneNote
Get-OneNoteHyperlink
Get-OneNoteHierarchy
Get-OneNoteTOC
Get-PageContent
Open-OneNote
Close-OneNote
Set-PageContent