├── .gitignore ├── LICENSE ├── OneNoteUtilities.config ├── OneNoteUtilitiesGraph ├── OneNoteUtilitiesGraph.psd1 ├── OneNoteUtilitiesGraph.psm1 ├── Private │ ├── Get-ONAuthCode.ps1 │ ├── Get-ONConfig.ps1 │ ├── Get-ONItem.ps1 │ ├── Get-ONItems.ps1 │ ├── Get-ONTokenStatus.ps1 │ ├── Get-ONaccessToken.ps1 │ ├── New-ONConfig.ps1 │ ├── New-ONJSONItem.ps1 │ └── Save-ONConfig.ps1 ├── Public │ ├── Get-ONDefaultSection.ps1 │ ├── Get-ONElement.ps1 │ ├── Get-ONNoteBook.ps1 │ ├── Get-ONNoteBooks.ps1 │ ├── Get-ONPage.ps1 │ ├── Get-ONPagePreview.ps1 │ ├── Get-ONPageXML.ps1 │ ├── Get-ONPages.ps1 │ ├── Get-ONRecentNoteBooks.ps1 │ ├── Get-ONResource.ps1 │ ├── Get-ONSection.ps1 │ ├── Get-ONSectionGroup.ps1 │ ├── Get-ONSectionGroups.ps1 │ ├── Get-ONSections.ps1 │ ├── Get-ONSessionVariables.ps1 │ ├── Get-ONTableAsObject.ps1 │ ├── Invoke-ONApp.ps1 │ ├── Invoke-ONDesktop.ps1 │ ├── Invoke-ONWeb.ps1 │ ├── New-ONElement.ps1 │ ├── New-ONNoteBook.ps1 │ ├── New-ONPage.ps1 │ ├── New-ONPageXML.ps1 │ ├── New-ONSection.ps1 │ ├── New-ONSectionGroup.ps1 │ ├── Remove-ONPage.ps1 │ ├── Set-ONPageLevel.ps1 │ ├── Test-ONUtilities.ps1 │ └── Update-ONelement.ps1 └── en-US │ ├── OneNoteUtilitiesGraph-help.xml │ └── about_OneNoteUtilitieGraph.help.txt ├── README.md ├── azure-pipelines.yml └── docs ├── Copy-ONPage.md ├── Copy-ONSection.md ├── Copy-ONSectionGroup.md ├── Get-ONAccessToken.md ├── Get-ONAuthCode.md ├── Get-ONConfig.md ├── Get-ONDefaultSection.md ├── Get-ONElement.md ├── Get-ONItem.md ├── Get-ONItems.md ├── Get-ONNoteBook.md ├── Get-ONNoteBooks.md ├── Get-ONPage.md ├── Get-ONPagePreview.md ├── Get-ONPageXML.md ├── Get-ONPages.md ├── Get-ONRecentNoteBooks.md ├── Get-ONResource.md ├── Get-ONSection.md ├── Get-ONSectionGroup.md ├── Get-ONSectionGroups.md ├── Get-ONSections.md ├── Get-ONSessionVariables.md ├── Get-ONTableAsObject.md ├── Get-ONTokenStatus.md ├── Invoke-ONApp.md ├── Invoke-ONDesktop.md ├── Invoke-ONWeb.md ├── New-ONElement.md ├── New-ONHTMLItem.md ├── New-ONJSONItem.md ├── New-ONNoteBook.md ├── New-ONPage.md ├── New-ONPageXML.md ├── New-ONSection.md ├── New-ONSectionGroup.md ├── Remove-ONElement.md ├── Remove-ONNoteBook.md ├── Remove-ONPage.md ├── Remove-ONSection.md ├── Remove-ONSectionGroup.md ├── Save-ONConfig.md ├── Set-ONPageLevel.md ├── Test-ONUtilities.md └── Update-ONElement.md /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/tasks.json 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Stuart Squibb 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /OneNoteUtilities.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/OneNoteUtilitiesGraph.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wightsci/OneNoteUtilitiesGraph/6b272d12055bbb6e34abb94db9f9d307eb1c6d2c/OneNoteUtilitiesGraph/OneNoteUtilitiesGraph.psd1 -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/OneNoteUtilitiesGraph.psm1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | Param() 3 | 4 | # Loader for external modules 5 | $ScriptRoot = Split-Path $Script:MyInvocation.MyCommand.Path 6 | $Public = @( Get-ChildItem -Path $ScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue ) 7 | $Private = @( Get-ChildItem -Path $ScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue ) 8 | @($Public + $Private) | Foreach-Object { . $_.FullName } 9 | Export-ModuleMember -Function $Public.Basename 10 | 11 | # Get settings from config file 12 | Get-ONConfig 13 | if (!$global:settings.clientid) { 14 | Write-Host "Would you like me to create a config file?" 15 | $cid = Read-Host -Prompt "Please provide your Graph client id, or N to exit" 16 | if ($cid.ToLower() -ne "n") { 17 | New-ONConfig -ClientID $cid.ToString() 18 | Get-ONConfig 19 | } 20 | else { 21 | Write-Host "Exiting." 22 | exit 23 | } 24 | } 25 | 26 | # Settings we don't want hard coded 27 | $clientID = $settings["clientid"] 28 | $scope = $settings["scope"] 29 | 30 | #Some Microsoft Graph URIs 31 | #https://graph.microsoft.com/{version}/users/{userPrincipalName}/onenote/ 32 | #https://graph.microsoft.com/{version}/users/{id}/onenote/ 33 | #https://graph.microsoft.com/{version}/groups/{id}/onenote/ 34 | #https://graph.microsoft.com/{version}/sites/{id}/onenote/ 35 | #https://graph.microsoft.com/v1.0/me/onenote 36 | 37 | $MSGraphRoot = 'https://graph.microsoft.com/v1.0/me/' 38 | $ONRoot = 'onenote/' 39 | $ONuri = "$MSGraphRoot$ONRoot" 40 | 41 | # Microsoft defined redirect endpoint for 'native' apps 42 | $redirectUri = "https://login.microsoftonline.com/common/oauth2/nativeclient" 43 | 44 | # Microsoft OAuth URIs 45 | $tokenUri = "https://login.microsoftonline.com/common/oauth2/v2.0/token" 46 | $authorizeUri = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize" 47 | 48 | # UrlEncode the ClientID, scope and URLs for special characters 49 | $clientIDEncoded = [System.Net.WebUtility]::UrlEncode($clientid) 50 | $redirectUriEncoded = [System.Net.WebUtility]::UrlEncode($redirectUri) 51 | $scopeEncoded = [System.Net.WebUtility]::UrlEncode($scope) 52 | 53 | # Build the URL for the authentication request 54 | $authURI = "$($authorizeUri)?response_type=code&redirect_uri=$redirectUriEncoded&client_id=$clientIDEncoded&scope=$scopeEncoded" 55 | 56 | # Default OneNote content styles, for reference. These are applied automatically. 57 | $defaultstyles = @{ 58 | 'body' = "font-family:Calibri;font-size:11pt" 59 | 'p' = "margin-top:0pt;margin-bottom:0pt" 60 | 'h1' = "font-size:16pt;color:#1e4e79;margin-top:0pt;margin-bottom:0pt" 61 | 'h2' = "font-size:14pt;color:#2e75b5;margin-top:0pt;margin-bottom:0pt" 62 | 'h3' = "font-size:12pt;color:#1f3763;margin-top:0pt;margin-bottom:0pt" 63 | 'h4' = "font-size:12pt;color:#2f5496;font-style:italic;margin-top:0pt;margin-bottom:0pt" 64 | 'h5' = "color:#2e75b5;margin-top:0pt;margin-bottom:0pt" 65 | 'h6' = "color:#2e75b5;font-style:italic;margin-top:0pt;margin-bottom:0pt" 66 | 'cite' = "font-size:9pt;color:#595959;margin-top:0pt;margin-bottom:0pt" 67 | 'quote' = "color:#595959;font-style:italic;margin-top:0pt;margin-bottom:0pt" 68 | 'code' = "font-family:Consolas;margin-top:0pt;margin-bottom:0pt" 69 | } 70 | 71 | # Stores the expiry of the Access Token 72 | # $tokenExpires = $((Get-Date).ToFileTimeUtc()) 73 | 74 | Function New-ONHTMLItem { 75 | 76 | } 77 | 78 | # Delete a OneNote NoteBook -- Not available in REST API 79 | Function Remove-ONNoteBook { 80 | 81 | } 82 | 83 | # Delete a OneNote Section Group -- Not available in REST API 84 | Function Remove-ONSectionGroup { 85 | 86 | } 87 | 88 | # Delete a OneNote Section -- Not available in REST API 89 | Function Remove-ONSection { 90 | 91 | } 92 | 93 | 94 | # Remove a OneNote Page Element - $TargetId on Page $Id 95 | Function Remove-ONElement { 96 | Param( 97 | [string] 98 | $TargetId, 99 | [string] 100 | $Id 101 | ) 102 | $page = Get-ONPageXML -Id $Id 103 | $element = $page.html.SelectSingleNode("//*[@id='$TargetId']") 104 | $element.RemoveAll() 105 | # To do - update the page content - could use Replace with nothing instead?? 106 | } 107 | 108 | # Copy a OneNote Page -- Not Implemented for consumer OneNote 109 | Function Copy-ONPage { 110 | Param( 111 | [parameter(ParameterSetName = 'page')] 112 | [object]$Page, 113 | [parameter(ParameterSetName = 'id')] 114 | [string]$Id, 115 | [parameter(ParameterSetName = 'page')] 116 | [parameter(ParameterSetName = 'id')] 117 | [string]$DestinationId = (Get-ONDefaultSection).Id 118 | ) 119 | 120 | if ($page) { 121 | $id = $page.Id 122 | } 123 | $body = New-ONJSONItem -hashtable @{ 'id' = "$destinationId" } 124 | Write-Verbose $body 125 | $uri = "{0}pages/{1}/copyToSection" -f $ONuri, $Id 126 | Write-Verbose $uri 127 | $response = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken" } -uri $uri -Method Post -Body $body -ContentType 'application/json' 128 | <# 129 | do { 130 | $operationresponse = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken"} -uri $operatiionuri -Method Get 131 | } 132 | #> 133 | Write-Verbose "Copy Page" 134 | Return $response 135 | 136 | } 137 | 138 | # Copy a OneNote Section -- Not Implemented for consumer OneNote 139 | Function Copy-ONSection { 140 | Param( 141 | [string]$DestinationId, 142 | [string]$Id 143 | ) 144 | $body = New-ONJSONItem -hashtable @{ 'id' = "$destinationId" } 145 | Write-Verbose $body 146 | $uri = "{0}sections/{1}/copyToSectionGroup" -f $ONuri, $Id 147 | Write-Verbose $uri 148 | $response = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken" } -uri $uri -Method Post -Body $body -ContentType 'application/json' 149 | Return $response 150 | } 151 | 152 | # Copy a OneNote Section Group -- Not Implemented for consumer OneNote 153 | Function Copy-ONSectionGroup { 154 | 155 | } 156 | 157 | Get-ONTokenStatus 158 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Private/Get-ONAuthCode.ps1: -------------------------------------------------------------------------------- 1 | # Get a Graph Authcode, using a web form if required 2 | Function Get-ONAuthCode { 3 | [cmdletbinding()] 4 | Param() 5 | Add-Type -AssemblyName System.Windows.Forms 6 | $form = New-Object -TypeName System.Windows.Forms.Form -Property @{Width=440;Height=640} 7 | $web = New-Object -TypeName System.Windows.Forms.WebBrowser -Property @{Width=420;Height=600;Url=$authURI} 8 | 9 | $DocComp = { 10 | $Global:authURI = $web.Url.AbsoluteUri 11 | if ($Global:authURI -match "error=[^&]*|code=[^&]*") { 12 | Write-Verbose "Closing. URL: $($Global:AuthURI)" 13 | $form.Close() 14 | } 15 | } 16 | 17 | $web.ScriptErrorsSuppressed = $true 18 | $web.Add_DocumentCompleted($DocComp) 19 | $form.Controls.Add($web) 20 | $form.Add_Shown({$form.Activate()}) 21 | $form.ShowDialog() | Out-Null 22 | $Global:authQuery = $web.url.Query 23 | Write-Verbose $web.Url.Query 24 | } 25 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Private/Get-ONConfig.ps1: -------------------------------------------------------------------------------- 1 | Function Get-ONConfig { 2 | Param( 3 | [string]$Path="$HOME\.config\OneNoteUtilities.config" 4 | ) 5 | $Global:settings = @{} 6 | if (Test-Path $path) { 7 | $config = [xml](Get-Content $path) 8 | foreach ($node in $config.settings.setting) { 9 | $value = $node.Value 10 | $Global:settings[$node.Name] = $value 11 | } 12 | } 13 | Else { 14 | Write-Error "No config file found. Please create one." 15 | # Exit 16 | } 17 | } -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Private/Get-ONItem.ps1: -------------------------------------------------------------------------------- 1 | # Generic call for OneNote Item. Creates a URI from an item type and ID 2 | # or uses a URI if provided. Returns metadata objects only if by ID. As a generic call 3 | # this should normally be accessed via one of the object specific wrapper 4 | # functions, such as Get-ONNoteBook 5 | Function Get-ONItem { 6 | [cmdletbinding()] 7 | Param( 8 | [Parameter(ParameterSetName='uri')] 9 | [string]$uri, 10 | [ValidateSet("notebooks","sectiongroups","sections","pages")] 11 | [Parameter(ParameterSetName='id')] 12 | [string]$ItemType, 13 | [Parameter(ParameterSetName='id')] 14 | [string]$Id 15 | ) 16 | 17 | if ($id) { 18 | $id = [System.Uri]::EscapeURIString($id) 19 | Write-Verbose $id 20 | $uri = '{0}{2}/{1}' -f $ONURI, $Id, $ItemType 21 | } 22 | Write-Verbose "URI: $uri" 23 | Get-ONTokenStatus 24 | $endloop = $false 25 | [Int]$retrycount = 0 26 | do { 27 | try { 28 | $workitem = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken"} -uri $uri #.html.InnerXML 29 | $endloop = $true 30 | } 31 | catch { 32 | if ($retrycount -gt 3) { 33 | throw $_ 34 | $endloop = $true 35 | } 36 | else { 37 | Start-Sleep -Seconds 1 38 | Write-Verbose "Waiting..." 39 | $Retrycount += 1 40 | } 41 | } 42 | 43 | } While ($endloop -eq $false) 44 | 45 | return $workitem 46 | 47 | } 48 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Private/Get-ONItems.ps1: -------------------------------------------------------------------------------- 1 | # Generic call for list of OneNote Items. The same notes apply 2 | # as for the singular Get-ONItem function. 3 | Function Get-ONItems { 4 | [CmdletBinding()] 5 | Param( 6 | [Parameter(ParameterSetName='type')] 7 | [Parameter(ParameterSetName='uri')] 8 | [switch]$List, 9 | [ValidateSet("notebooks","sectiongroups","sections","pages")] 10 | [Parameter(ParameterSetName='type')] 11 | [string]$ItemType, 12 | [Parameter(ParameterSetName='type')] 13 | [Parameter(ParameterSetName='uri')] 14 | [string]$Filter, 15 | [Parameter(ParameterSetName='uri')] 16 | [String]$uri 17 | ) 18 | 19 | if ($filter) { 20 | $filter = [System.Net.WebUtility]::UrlEncode($filter) 21 | $filter = "`&`$filter=$filter" 22 | } 23 | 24 | if ($uri) { 25 | #$workuri ='{0}?top=20{1}' -f $uri, $filter 26 | $workuri = '{0}?{1}' -f $uri, $filter 27 | #$workuri = $uri 28 | } 29 | else { 30 | #$workuri = '{0}{2}?$top=100{1}&$orderby=createdDateTime' -f $ONuri, $filter, $itemtype 31 | $workuri = '{0}{2}?{1}' -f $ONuri, $filter, $itemtype 32 | } 33 | 34 | 35 | Get-ONTokenStatus 36 | 37 | # Use paging... 38 | do { 39 | $onitemlist = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken"} -uri $workuri -Method Get 40 | if ($onitemlist.'@odata.nextLink') { 41 | $workuri = $onitemlist.'@odata.nextLink' 42 | Write-Verbose "Next: $workuri" 43 | } 44 | if ($list.isPresent) { 45 | $r += $onitemlist.value 46 | } 47 | else { 48 | $onitemlist.value | ForEach-Object { 49 | Get-ONItem -uri $_.contenturl 50 | } 51 | } 52 | } While ($workuri -eq $onitemlist.'@odata.nextLink') 53 | Return $r 54 | } 55 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Private/Get-ONTokenStatus.ps1: -------------------------------------------------------------------------------- 1 | # Auth code only valid for 1 hour 2 | # Refresh token valid for 14 days 3 | # Access token valid for 1 hour 4 | Function Get-ONTokenStatus { 5 | [cmdletbinding()] 6 | Param() 7 | Write-Verbose "Token Expires: $tokenExpires" 8 | Write-Verbose "Curent DateTime: $((Get-Date).ToFileTimeUtc())" 9 | Write-Verbose "Current Auth Code: $authCode" 10 | if (("$((Get-Date).ToFileTimeUtc())" -ge "$tokenExpires") -or !$authcode ) { 11 | Get-ONAuthCode 12 | # Extract Access token from the returned URI 13 | $Global:authQuery -match '\?code=(.*)' | Out-Null 14 | $Global:authCode = $matches[1] 15 | Write-Verbose "Received an authCode, $authCode" 16 | Get-ONAccessToken 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Private/Get-ONaccessToken.ps1: -------------------------------------------------------------------------------- 1 | # Get a Graph Access Token 2 | Function Get-ONAccessToken { 3 | [cmdletbinding()] 4 | Param() 5 | if ($refresh_token) { 6 | $body = "grant_type=refresh_token&redirect_uri=$redirectUriEncoded&client_id=$clientIdEncoded&refresh_token=$refresh_token&scope=$scopeEncoded" 7 | } 8 | else { 9 | $body = "grant_type=authorization_code&redirect_uri=$redirectUriEncoded&client_id=$clientIdEncoded&code=$authCode&scope=$scopeEncoded" 10 | } 11 | Write-Verbose $body 12 | $Authorization = Invoke-RestMethod -uri $tokenuri -Method Post -ContentType "application/x-www-form-urlencoded" -Body $body -ErrorAction STOP 13 | $Global:accesstoken = $Authorization.access_token 14 | $Global:refresh_token = $Authorization.refresh_token 15 | $Global:tokenExpires = "$((Get-Date).AddSeconds($Authorization.expires_in).ToFileTimeUtc())" 16 | Write-Verbose "Token Expires at: $((Get-Date).AddSeconds($Authorization.expires_in).ToFileTimeUtc())" 17 | Write-Verbose "Refresh Token: $refresh_token" 18 | } 19 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Private/New-ONConfig.ps1: -------------------------------------------------------------------------------- 1 | function New-ONConfig { 2 | Param( 3 | [string]$ClientID 4 | ) 5 | [xml]$configtemplate = @" 6 | 7 | 8 | 9 | 10 | 11 | "@ 12 | $path="$HOME\.config\OneNoteUtilities.config" 13 | $configtemplate.Save($path) 14 | } -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Private/New-ONJSONItem.ps1: -------------------------------------------------------------------------------- 1 | Function New-ONJSONItem { 2 | Param( 3 | $Hashtable 4 | ) 5 | $workJSOn = $hashtable | ConvertTo-Json 6 | Return $workJSON 7 | } -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Private/Save-ONConfig.ps1: -------------------------------------------------------------------------------- 1 | Function Save-ONConfig { 2 | [CmdletBinding()] 3 | Param( 4 | [string]$path="$HOME\.config\OneNoteUtilities.config", 5 | [switch]$Force 6 | ) 7 | $config = [xml]'' 8 | foreach ($node in $settings.Keys) { 9 | $setting = $config.CreateElement('setting') 10 | $setting.SetAttribute('name',$node) 11 | $setting.SetAttribute('value',$settings[$node]) 12 | $config['settings'].AppendChild($setting) | Out-Null 13 | } 14 | if ((Test-Path $path) -and (!$Force.IsPresent)) { 15 | Throw "Config file exists" 16 | } 17 | else { 18 | $config.Save($path) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONDefaultSection.ps1: -------------------------------------------------------------------------------- 1 | # Gets the default OneNote Section for new content creation 2 | Function Get-ONDefaultSection { 3 | Get-ONSections -filter "isDefault eq true" 4 | } 5 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONElement.ps1: -------------------------------------------------------------------------------- 1 | # Get an element on a page - returned as an XML element 2 | Function Get-ONElement { 3 | Param( 4 | [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'id')] 5 | [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'data-id')] 6 | [object]$Page, 7 | [Parameter(Mandatory = $true, ParameterSetName = 'id')] 8 | [string]$Id, 9 | [Parameter(Mandatory = $true, ParameterSetName = 'data-id')] 10 | [string]$DataId 11 | ) 12 | if ($dataId) { $id = $dataId } 13 | switch ($Page.GetType().Name) { 14 | 'PSCustomObject' { 15 | $page = Get-ONPageXML -page $page 16 | break 17 | } 18 | 'XmlDocument' { 19 | 20 | } 21 | } 22 | $workElement = $page.SelectSingleNode("/html/body//*[@$($PSCmdlet.ParameterSetName)='$($id)']") 23 | Return $workElement 24 | } 25 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONNoteBook.ps1: -------------------------------------------------------------------------------- 1 | # Get a OneNote Notebook 2 | Function Get-ONNoteBook { 3 | Param( 4 | [Parameter(ParameterSetName = 'uri', Mandatory = $true)] 5 | [string]$Uri, 6 | [Parameter(ParameterSetName = 'id', ValueFromPipelineByPropertyName = $true, Mandatory = $true)] 7 | [string]$Id 8 | ) 9 | 10 | if ($uri) { 11 | Get-ONItem -uri $uri 12 | } 13 | 14 | if ($Id) { 15 | Get-ONItem -ItemType 'noteBooks' -Id $Id 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONNoteBooks.ps1: -------------------------------------------------------------------------------- 1 | # Get a list of OneNote Notebooks 2 | Function Get-ONNoteBooks { 3 | Param( 4 | [parameter(ParameterSetName = 'filter', Mandatory = $False)] 5 | [string]$Filter 6 | ) 7 | if ($Filter) { 8 | Get-ONItems -List -ItemType 'notebooks' -Filter $filter 9 | } 10 | else { 11 | Get-ONItems -List -uri "$($ONURI)notebooks" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONPage.ps1: -------------------------------------------------------------------------------- 1 | # Get a OneNote Page - just the metadata 2 | Function Get-ONPage { 3 | Param( 4 | [Parameter(ParameterSetName = 'uri', Mandatory = $true)] 5 | [string]$Uri, 6 | [Parameter(ParameterSetName = 'id', ValueFromPipelineByPropertyName = $true, Mandatory = $true)] 7 | [string]$Id 8 | ) 9 | 10 | if ($uri) { 11 | Get-ONItem -uri $uri 12 | } 13 | 14 | if ($Id) { 15 | Get-ONItem -ItemType 'pages' -Id $Id 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONPagePreview.ps1: -------------------------------------------------------------------------------- 1 | # Get the preview text for a OneNote Page 2 | Function Get-ONPagePreview { 3 | [CmdletBinding()] 4 | Param( 5 | [Parameter(ValueFromPipelineByPropertyName = $true, Mandatory = $true)] 6 | [string]$Id 7 | ) 8 | $workuri = "{0}pages/{1}/preview" -f $ONuri, $id 9 | Write-Verbose $workuri 10 | (Get-ONItem -uri $workuri).previewText 11 | } -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONPageXML.ps1: -------------------------------------------------------------------------------- 1 | # Gets the XHTML content of a Page 2 | Function Get-ONPageXML { 3 | Param( 4 | [Parameter(ParameterSetName='page',Mandatory=$true,ValueFromPipeline=$true)] 5 | [object]$Page, 6 | [Parameter(ParameterSetName='id',Mandatory=$true,ValueFromPipeline=$true)] 7 | [string]$Id, 8 | [Parameter()] 9 | [Switch]$AsText 10 | ) 11 | #$html = New-Object System.Xml.XmlDocument 12 | switch ($PSCmdlet.ParameterSetName) { 13 | "page" { 14 | $workuri = "{0}{1}" -f "$($Page.contenturl)" , '?includeIDS=true' 15 | } 16 | "id" { 17 | $workuri = "{0}{1}" -f (Get-ONPage -id $id).contenturl, '?includeIDS=true' 18 | } 19 | } 20 | $html = (Get-ONItem -uri $workuri) 21 | if ($ASText.IsPresent) { 22 | Return $html.OuterXML 23 | } 24 | else { 25 | Return $html 26 | } 27 | } -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONPages.ps1: -------------------------------------------------------------------------------- 1 | # Get a list of OneNote Pages matching the given Filter 2 | Function Get-ONPages { 3 | [CmdletBinding()] 4 | Param( 5 | [parameter(ParameterSetName = 'filter', Mandatory = $true)] 6 | [string]$Filter, 7 | [parameter(ParameterSetName = "uri", Mandatory = $false)] 8 | [string]$Uri = "$($ONURI)pages" 9 | ) 10 | if ($Filter) { 11 | Get-ONItems -List -ItemType 'pages' -Filter $filter 12 | } 13 | else { 14 | Write-Verbose $uri 15 | Get-ONItems -List -uri $uri 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONRecentNoteBooks.ps1: -------------------------------------------------------------------------------- 1 | # Get a list of recently accessed OneNote NoteBooks 2 | Function Get-ONRecentNoteBooks { 3 | $uri = "{0}{1}" -f $ONuri, 'notebooks/getrecentnotebooks(includePersonalNotebooks=true)' 4 | $response = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken" } -uri $uri -Method Get 5 | Return $response.value 6 | } -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONResource.ps1: -------------------------------------------------------------------------------- 1 | # Gets the binary data of a file or image resource object 2 | Function Get-ONResource { 3 | Param( 4 | [Parameter(Mandatory = $true)] 5 | [string]$Uri, 6 | [Parameter(Mandatory = $true)] 7 | [string]$Path 8 | ) 9 | Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken" } -uri $Uri -OutFile $Path 10 | } 11 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONSection.ps1: -------------------------------------------------------------------------------- 1 | # Get a OneNote Section 2 | Function Get-ONSection { 3 | Param( 4 | [Parameter(ParameterSetName = 'uri', Mandatory = $true)] 5 | [string]$Uri, 6 | [Parameter(ParameterSetName = 'id', ValueFromPipelineByPropertyName = $true, Mandatory = $true)] 7 | [string]$Id 8 | ) 9 | 10 | if ($uri) { 11 | Get-ONItem -uri $uri 12 | } 13 | 14 | if ($Id) { 15 | Get-ONItem -ItemType 'sections' -Id $Id 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONSectionGroup.ps1: -------------------------------------------------------------------------------- 1 | # Get a OneNote Section Group 2 | Function Get-ONSectionGroup { 3 | Param( 4 | [Parameter(ParameterSetName = 'uri', Mandatory = $true)] 5 | [string]$Uri, 6 | [Parameter(ParameterSetName = 'id', ValueFromPipelineByPropertyName = $true, Mandatory = $true)] 7 | [string]$Id 8 | ) 9 | 10 | if ($uri) { 11 | Get-ONItem -uri $uri 12 | } 13 | 14 | if ($Id) { 15 | Get-ONItem -ItemType 'sectiongroups' -Id $Id 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONSectionGroups.ps1: -------------------------------------------------------------------------------- 1 | # Gets a list of OneNote Section Groups matching the supplied filter, or a list 2 | Function Get-ONSectionGroups { 3 | [CmdletBinding()] 4 | Param( 5 | [parameter(ParameterSetName = 'filter', Mandatory = $true)] 6 | [string]$Filter, 7 | [parameter(ParameterSetName = "uri", Mandatory = $false)] 8 | [string]$Uri = "$($ONURI)sectiongroups" 9 | ) 10 | if ($Filter) { 11 | Get-ONItems -List -ItemType 'sectiongroups' -Filter $filter 12 | } 13 | else { 14 | Write-Verbose $uri 15 | Get-ONItems -List -uri $uri 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONSections.ps1: -------------------------------------------------------------------------------- 1 | # Get a list of OneNote Sections 2 | Function Get-ONSections { 3 | [CmdletBinding()] 4 | Param( 5 | [parameter(ParameterSetName = 'filter', Mandatory = $true)] 6 | [string]$Filter, 7 | [parameter(ParameterSetName = "uri", Mandatory = $false)] 8 | [string]$Uri = "$($ONURI)sections" 9 | ) 10 | if ($Filter) { 11 | Get-ONItems -List -ItemType 'sections' -Filter $filter 12 | } 13 | else { 14 | Write-Verbose $uri 15 | Get-ONItems -List -uri $uri 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONSessionVariables.ps1: -------------------------------------------------------------------------------- 1 | # Gets some useful information about the OneNote session 2 | Function Get-ONSessionVariables { 3 | [CmdletBinding()] 4 | Param() 5 | Write-Host ("OneNote URI : {0}" -f "$ONuri") 6 | Write-Host ("Auth Code : {0}" -f "$authCode") 7 | Write-Host ("Token Expires at : {0}" -f "$tokenExpires") 8 | Write-Host ("(Local Time) : {0}" -f "$(([DateTime]::FromFileTimeUTC($tokenExpires)).ToLocalTime().ToString())") 9 | Write-Host ("Refresh Token : {0}" -f "$refresh_token") 10 | Write-Host ("Access Token : {0}" -f "$accesstoken") 11 | } 12 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Get-ONTableAsObject.ps1: -------------------------------------------------------------------------------- 1 | # Gets a table from a OneNote Page, as a custom object 2 | function Get-ONTableAsObject { 3 | [CmdletBinding()] 4 | Param( 5 | [Parameter(Mandatory = $true, ValueFromPipeline = $true)] 6 | $Table, 7 | [Switch]$NoHeaders 8 | ) 9 | $cols = $table.tr[0].td.Count 10 | $rows = $table.tr.Count 11 | 12 | Write-Debug "Rows: $rows, Columns: $cols" 13 | 14 | $tableObject = [System.Collections.ArrayList]@() 15 | $headers = @() 16 | 17 | if ($NoHeaders.IsPresent) { 18 | for ( $h = 0; $h -lt $cols; $h++ ) { 19 | $headers += ("Column $h") 20 | } 21 | 22 | } 23 | else { 24 | 25 | for ( $h = 0; $h -lt $cols; $h++ ) { 26 | $headers += ($table.tr[0].td[$h].InnerText) 27 | } 28 | 29 | } 30 | 31 | 32 | for ($i = 0; $i -lt $rows; $i++) { 33 | 34 | $rowObject = New-Object PSCustomObject 35 | 36 | if (!$NoHeaders.IsPresent -and $i -eq 0) { 37 | 38 | } 39 | else { 40 | 41 | for ($c = 0 ; $c -lt $cols; $c++) { 42 | Write-Debug "Row $i, Column $c" 43 | $rowObject | Add-Member -MemberType NoteProperty -Name $headers[$c] -Value $table.tr[$i].td[$c].InnerText 44 | 45 | } 46 | [Void]$tableObject.Add($rowObject) 47 | } 48 | 49 | } 50 | 51 | return $tableObject 52 | } -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Invoke-ONApp.ps1: -------------------------------------------------------------------------------- 1 | # Invoke the default OneNote application and load a page 2 | Function Invoke-ONApp { 3 | [CmdletBinding(DefaultParameterSetName = 'page')] 4 | Param( 5 | [parameter(Position = 0, ParameterSetName = "page", Mandatory = $true)] 6 | [object]$Page, 7 | [parameter(Position = 0, ParameterSetName = "id", Mandatory = $true)] 8 | [string]$Id 9 | ) 10 | If ($Id) { 11 | $page = Get-ONItem -ItemType 'pages' -Id $id 12 | } 13 | Start-Process $page.links.oneNoteClientUrl.href 14 | } -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Invoke-ONDesktop.ps1: -------------------------------------------------------------------------------- 1 | # Invoke the Office 365 OneNote application and load a page 2 | Function Invoke-ONDesktop { 3 | [CmdletBinding(DefaultParameterSetName = 'page')] 4 | Param( 5 | [parameter(Position = 0, ParameterSetName = "page", Mandatory = $true)] 6 | [object]$Page, 7 | [parameter(Position = 0, ParameterSetName = "id", Mandatory = $true)] 8 | [string]$Id 9 | ) 10 | If ($Id) { 11 | $page = Get-ONItem -ItemType 'pages' -Id $id 12 | } 13 | # Location of the OneNote executable can be found at: 14 | # HKEY_LOCAL_MACHINE\SOFTWARE\Classes\OneNote\shell\Open\command 15 | $ONShellCommand = (Get-ItemProperty -Path HKLM:\SOFTWARE\Classes\OneNote\shell\Open\command).'(default)' 16 | #Clean up the registry entry so that we can reuse it 17 | $ONShellCommand = ($ONShellCommand -split "/hyperlink" -replace '"')[0] 18 | Start-Process $ONShellCommand -ArgumentList '/hyperlink', $page.links.oneNoteClientUrl.href 19 | } -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Invoke-ONWeb.ps1: -------------------------------------------------------------------------------- 1 | # Invoke the OneNote web app and load a page 2 | Function Invoke-ONWeb { 3 | [CmdletBinding(DefaultParameterSetName = 'page')] 4 | Param( 5 | [Parameter(Position = 0, ParameterSetName = 'page', Mandatory = $true)] 6 | [object]$Page, 7 | [Parameter(Position = 0, ParameterSetName = 'Id', Mandatory = $true)] 8 | [string]$Id 9 | ) 10 | If ($Id) { 11 | $page = Get-ONItem -ItemType 'pages' -Id $id 12 | } 13 | Start-Process $page.links.oneNoteWebUrl.href 14 | } 15 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/New-ONElement.ps1: -------------------------------------------------------------------------------- 1 | # Create a new element 2 | Function New-ONElement { 3 | Param( 4 | [Parameter(Mandatory = $true)] 5 | [ValidateSet( 6 | "head", "body", "title", "meta", "h1", "h2", "h3", "h4", "h5", "h6", "p", "ul", "ol", "li", "pre", "b", "i", "table", "tr", "td", "div", "span", "img", "br", "cite", "text" 7 | )] 8 | [string]$Type, 9 | [Parameter()] 10 | [object]$Document = (New-Object -TypeName System.Xml.XmlDocument) 11 | ) 12 | if ($Type -eq 'text') { 13 | $workelement = $Document.CreateTextNode('') 14 | } 15 | else { 16 | $workelement = $Document.CreateElement($Type) 17 | $workelement.setAttribute("lang", "en-GB") 18 | #$workElement.load(([String]$workelement).replace('"',"'")) 19 | } 20 | 21 | Return $workelement 22 | } 23 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/New-ONNoteBook.ps1: -------------------------------------------------------------------------------- 1 | # Create a new OneNote NoteBook 2 | Function New-ONNoteBook { 3 | Param ( 4 | [Parameter(Mandatory = $true)] 5 | [string]$DisplayName 6 | ) 7 | $uri = "{0}{1}" -f $ONuri, 'notebooks' 8 | $body = New-ONJSONItem -hashtable @{ 'displayname' = $DisplayName } 9 | Write-Verbose $body 10 | Get-ONTokenStatus 11 | $response = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken" } -uri $uri -Method post -Body $body -ContentType "application/json" 12 | Write-Verbose "NoteBook" 13 | Return $response 14 | } 15 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/New-ONPage.ps1: -------------------------------------------------------------------------------- 1 | # Create new Page in OneNote. Uses the default section if no section URI provided 2 | Function New-ONPage { 3 | Param( 4 | [Parameter(ParameterSetName = 'html')] 5 | [Parameter(ParameterSetName = 'page')] 6 | [string]$Uri = (Get-ONDefaultSection).pagesUrl, 7 | [Parameter(ParameterSetName = 'html', Mandatory = $true)] 8 | [string]$Html, 9 | [Parameter(ParameterSetName = 'page', Mandatory = $true)] 10 | [object]$Page 11 | ) 12 | 13 | if ($Page) { 14 | $html = $page.OuterXML 15 | } 16 | 17 | $body = "{0}{1}" -f '', $html 18 | Write-Verbose $body 19 | Get-ONTokenStatus 20 | $response = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken" } -uri $uri -Method post -Body $body -ContentType "text/html" 21 | Write-Verbose "Page" 22 | Return $response 23 | } 24 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/New-ONPageXML.ps1: -------------------------------------------------------------------------------- 1 | # Creates a new XHTML page with Title and appropriate metadata 2 | Function New-ONPageXML { 3 | Param( 4 | [Parameter(Mandatory = $true)] 5 | [string]$Title 6 | ) 7 | 8 | <# 9 | Create pages as an XML document to allow the normal DOM type manipulations, then when done, 10 | coerce the page to a string and add the "" to the top before passing it to the Graph 11 | #> 12 | 13 | $xmldoc = New-Object System.Xml.XmlDocument 14 | $xmldoc.InnerXml = '' 15 | $xmldoc.DocumentElement.SetAttribute("lang", "en-GB") 16 | $tag = New-ONElement -type head -Document $xmldoc 17 | $head = $xmldoc.DocumentElement.AppendChild($tag) 18 | $tag = New-ONElement -Type title -Document $xmldoc 19 | $tag.innertext = $Title 20 | $title = $head.AppendChild($tag) 21 | $tag = New-ONElement -type meta -Document $xmldoc 22 | $tag.setAttribute('http-equiv', "Content-Type") 23 | $tag.setAttribute('content', 'text/html; charset=utf-8') 24 | $meta = $head.AppendChild($tag) 25 | $tag = New-ONElement -type meta -Document $xmldoc 26 | $tag.setAttribute('name', "created") 27 | $tag.setAttribute('content', $((Get-Date).ToString('O'))) 28 | $meta = $head.AppendChild($tag) 29 | $tag = New-ONElement -Type body -Document $xmldoc 30 | $body = $xmldoc.DocumentElement.AppendChild($tag) 31 | Return $xmldoc 32 | } 33 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/New-ONSection.ps1: -------------------------------------------------------------------------------- 1 | # Create a new OneNote Section 2 | Function New-ONSection { 3 | Param( 4 | [Parameter(ParameterSetName = 'ByID', Mandatory = $true)] 5 | [Parameter(ParameterSetName = 'ByUri', Mandatory = $true)] 6 | [string]$DisplayName, 7 | [Parameter(ParameterSetName = 'ByUri', Mandatory = $true)] 8 | [string]$Uri, 9 | [Parameter(ParameterSetName = 'ByID', Mandatory = $true)] 10 | [string]$Id, 11 | [Parameter(ParameterSetName = "ByID")] 12 | [switch]$SectionGroup 13 | ) 14 | if ($id) { 15 | if ($SectionGroup.IsPresent) { 16 | $uri = "{0}sectionGroups/{1}/sections" -f $ONuri, $id 17 | } 18 | else { 19 | $uri = "{0}notebooks/{1}/sections" -f $ONuri, $id 20 | } 21 | } 22 | $body = New-ONJSONItem -hashtable @{ 'displayname' = $DisplayName } 23 | Write-Verbose $body 24 | Get-ONTokenStatus 25 | $response = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken" } -uri $uri -Method post -Body $body -ContentType "application/json" 26 | Write-Verbose "Section" 27 | Return $response 28 | 29 | } 30 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/New-ONSectionGroup.ps1: -------------------------------------------------------------------------------- 1 | # Create a new OneNote Section Group 2 | Function New-ONSectionGroup { 3 | Param( 4 | [Parameter(ParameterSetName = 'ByID', Mandatory = $true)] 5 | [Parameter(ParameterSetName = 'ByUri', Mandatory = $true)] 6 | [string]$DisplayName, 7 | [Parameter(ParameterSetName = 'ByUri', Mandatory = $true)] 8 | [string]$Uri, 9 | [Parameter(ParameterSetName = 'ByID', Mandatory = $true)] 10 | [string]$Id 11 | ) 12 | if ($id) { 13 | $uri = "{0}notebooks/{1}/sectiongroups" -f $ONuri, $id 14 | } 15 | $body = New-ONJSONItem -hashtable @{ 'displayname' = $DisplayName } 16 | Write-Verbose $body 17 | Get-ONTokenStatus 18 | $response = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken" } -uri $uri -Method post -Body $body -ContentType "application/json" 19 | Write-Verbose "SectionGroup" 20 | Return $response 21 | } 22 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Remove-ONPage.ps1: -------------------------------------------------------------------------------- 1 | # Delete a OneNote Page 2 | Function Remove-ONPage { 3 | Param ( 4 | [Parameter(Mandatory = $true)] 5 | [string]$Id 6 | ) 7 | $uri = "{0}{1}/{2}" -f $ONuri, 'pages', $Id 8 | Get-ONTokenStatus 9 | $response = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken" } -uri $uri -Method delete 10 | Write-Verbose "Page" 11 | Return $response 12 | } 13 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Set-ONPageLevel.ps1: -------------------------------------------------------------------------------- 1 | # Set the level of a NoneNote Page 2 | Function Set-ONPageLevel { 3 | Param( 4 | [Parameter(Mandatory = $true)] 5 | [string]$Id, 6 | [Parameter(Mandatory = $true)] 7 | [ValidateSet(0, 1, 2)] 8 | $Level 9 | ) 10 | $uri = "{0}{1}/{2}" -f $ONuri, 'pages', $Id 11 | $body = ConvertTo-Json @{ 'level' = "$Level" } 12 | Get-ONTokenStatus 13 | $response = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken" } -uri $uri -Method Patch -ContentType 'application/json' -body $body 14 | Return $response 15 | } -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Test-ONUtilities.ps1: -------------------------------------------------------------------------------- 1 | # Some tests of functionality... 2 | Function Test-ONUtilities { 3 | [CmdletBinding()] 4 | Param() 5 | 6 | Write-Verbose "Test Suite" 7 | Write-Verbose "==========" 8 | 9 | Write-Verbose "_-Getting Default Section-_" 10 | $ds = Get-ONDefaultSection 11 | $ds | Select-Object * | Write-Verbose 12 | 13 | Write-Verbose "_-Creating a new Page-_" 14 | $np = New-ONPageXML -Title "Test Page $((Get-Date).toString())" 15 | $h1 = New-ONElement -Type h1 -Document $np 16 | $h1.InnerText = 'Hello World' 17 | [void]$np['html']['body'].AppendChild($h1) 18 | $workuri = $ds.pagesUrl 19 | Write-Verbose "Creating Page at: $workuri" 20 | $response = New-ONPage -URI $workuri -Page $np 21 | Write-Verbose "Sent" 22 | 23 | Write-Verbose "_-Trying to get the new Page-_" 24 | Start-Sleep -Seconds 3 25 | Get-ONPage -id $response.Id | ForEach-Object { (Get-ONPageXML -Page $_).OuterXML } 26 | 27 | Write-Verbose "_-Trying to get a specific element from a specific Page-_" 28 | $p = Get-ONPageXML -Page (Get-ONPage -id '0-e05582da051f07451e1cd93706e57838!1-816F7725BEF00A5F!1299') 29 | Get-ONElement -page $p -id 'div:{c2203899-70ef-0fcb-135b-bc6bfdfc4e09}{32}' 30 | 31 | Write-Verbose "_-Testing Paging-_" 32 | (Get-ONPages -uri "$((Get-ONSections -Filter "displayName eq 'Unfiled Notes'").pagesurl)").Count 33 | 34 | } 35 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/Public/Update-ONelement.ps1: -------------------------------------------------------------------------------- 1 | # Update an existing element on a OneNote Page 2 | Function Update-ONElement { 3 | Param( 4 | [Parameter(Mandatory = $true)] 5 | [string]$Id, 6 | [Parameter(Mandatory = $true)] 7 | [string]$TargetId, 8 | [Parameter(Mandatory = $true)] 9 | [ValidateSet('replace', 'append', 'delete', 'prepend')] 10 | [string]$Action, 11 | [Parameter(Mandatory = $true)] 12 | [string]$Content, 13 | [Parameter(Mandatory = $false)] 14 | [ValidateSet('after', 'before')] 15 | [string]$Position = 'before' 16 | ) 17 | Get-ONTokenStatus 18 | $uri = "{0}{1}/{2}/content" -f $ONuri, 'pages', $Id 19 | $body = ConvertTo-Json @{ 'target' = "$targetId"; 'action' = "$action"; 'content' = $content; 'position' = "$position" } 20 | Write-Verbose $body 21 | Get-ONTokenStatus 22 | $response = Invoke-RestMethod -Headers @{Authorization = "Bearer $accesstoken" } -uri $uri -Method Patch -ContentType 'application/json' -body $body 23 | Return $response 24 | 25 | } 26 | -------------------------------------------------------------------------------- /OneNoteUtilitiesGraph/en-US/about_OneNoteUtilitieGraph.help.txt: -------------------------------------------------------------------------------- 1 | TOPIC 2 | about_OneNoteUtilitiesGraph 3 | 4 | SHORT DESCRIPTION 5 | The underlying ideas behind the OneNoteUtilitiesGraph module. 6 | 7 | LONG DESCRIPTION 8 | The purpose of the OneNoteUtilitiesGraph module is to allow programmatic access to 9 | information stored in the cloud version of OneNote. This includes both the structure 10 | of the OneNote data (NoteBooks, SectionsGroups, Sections, Pages) but also the page contents 11 | themselves as structured XHTML data. The idea is to allow automation of tasks that are 12 | time-consuming using the User Interface and to possibly allow integration with other 13 | apps and services. 14 | 15 | OneNoteUtilitiesGraph is designed to be used both from within scripts and also from 16 | the command line. 17 | 18 | EXAMPLES 19 | 20 | KEYWORDS 21 | OneNote 22 | 23 | SEE ALSO -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OneNoteUtilitiesGraph 2 | PowerShell module for manipulating [Microsoft OneNote](https://www.onenote.com/) data using the Microsoft Graph REST API. 3 | 4 | Following on from OneNoteUtilities this module uses the Microsoft Graph API instead of the desktop COM objects. 5 | 6 | ### Update November 5, 2019 7 | Following Microsoft's decision to continue support for the desktop version of OneNote I have added an additional command (`Invoke-ONDesktop`) to open OneNote pages in the desktop application specifically, rather than whichever application has been registered as the handler for the `onenote:` protocol. 8 |
9 | 10 | This module provides the following functions: 11 | 12 | * [Get-ONConfig](docs/Get-ONConfig.md) 13 | * [Get-ONDefaultSection](docs/Get-ONDefaultSection.md) 14 | * [Get-ONElement](docs/Get-ONElement.md) 15 | * [Get-ONNoteBook](docs/Get-ONNoteBook.md) 16 | * [Get-ONNoteBooks](docs/Get-ONNoteBooks.md) 17 | * [Get-ONPage](docs/Get-ONPage.md) 18 | * [Get-ONPagePreview](docs/Get-ONPagePreview.md) 19 | * [Get-ONPages](docs/Get-ONPages.md) 20 | * [Get-ONPageXML](docs/Get-ONPageXML.md) 21 | * [Get-ONRecentNoteBooks](docs/Get-ONRecentNoteBooks.md) 22 | * [Get-ONResource](docs/Get-ONResource.md) 23 | * [Get-ONResources](docs/Get-ONResources.md) 24 | * [Get-ONSection](docs/Get-ONSection.md) 25 | * [Get-ONSectionGroup](docs/Get-ONSectionGroup.md) 26 | * [Get-ONSectionGroups](docs/Get-ONSectionGroups.md) 27 | * [Get-ONSections](docs/Get-ONSections.md) 28 | * [Get-ONSessionVariables](docs/Get-ONSessionVariables.md) 29 | * [Get-ONTableAsObject](docs/Get-ONTableAsObject.md) 30 | * [Get-ONTokenStatus](docs/Get-ONTokenStatus.md) 31 | * [Invoke-ONApp](docs/Invoke-ONApp.md) 32 | * [Invoke-ONDesktop](docs/Invoke-ONDesktop.md) 33 | * [Invoke-ONWeb](docs/Invoke-ONWeb.md) 34 | * [New-ONElement](docs/New-ONElement.md) 35 | * [New-ONNoteBook](docs/New-ONNoteBook.md) 36 | * [New-ONPage](docs/New-ONPage.md) 37 | * [New-ONPageXML](docs/New-ONPageXML.md) 38 | * [New-ONSection](docs/New-ONSection.md) 39 | * [New-ONSectionGroup](docs/New-ONSectionGroup.md) 40 | * [Remove-ONPage](docs/Remove-ONPage.md) 41 | * [Save-ONConfig ](docs/Save-ONConfig.md) 42 | * [Set-ONPageLevel](docs/Set-ONPageLevel.md) 43 | * [Test-ONUtilities](docs/Test-ONUtilities.md) 44 | * [Update-ONElement](docs/Update-ONElement.md) 45 | * ~Remove-ONNoteBook~ 46 | * ~Remove-ONSectionGroup~ 47 | * ~Remove-ONSection~ 48 | * ~Remove-ONElement~ 49 | * ~Copy-ONPage~ 50 | 51 | ## Installation 52 | 53 | Before installing the module, ensure that you have a client ID for the Microsoft Graph service. See the following for more information [https://docs.microsoft.com/en-us/graph/auth-register-app-v2](https://docs.microsoft.com/en-us/graph/auth-register-app-v2). 54 | 55 | Create a config XML file containing your client ID and security scope information, named OneNoteUtilities.config and place it in your .config folder. 56 | There is a [template file](https://raw.githubusercontent.com/wightsci/OneNoteUtilitiesGraph/master/OneNoteUtilities.config) in this repo on GitHub. 57 | 58 | Download the module, extract it to a location in your modules path and use ```Import-Module```. The process of importing will trigger an attempt to connect to Microsoft Graph. *This will fail if you haven't set up the config file*. 59 | 60 | ## Use Case - Creating Structure 61 | 62 | Suppose that you need to create a new Notebook, create Sections for the months of the year and create a Page for each day of each month. You would like the title of each page to look like 'Friday, 26th June 2019' in format. With OneNoteUtiliesGraph you can do this: 63 | 64 | ```powershell 65 | Import-Module OneNoteUtilitiesGraph 66 | #Create NoteBook 67 | $NoteBook = New-ONNoteBook -DisplayName (Get-Date).Year 68 | #Create Section per Month 69 | (1..12) | % { 70 | $month = $_; 71 | $monthName = (Get-Date -Month $_).ToString('MMMM') 72 | $Section = New-ONSection -Id $NoteBook.Id -DisplayName $monthName 73 | #Create Page per Day 74 | (1..$([DateTime]::DaysInMonth((Get-Date).Year,$month))) | % { 75 | $Page = New-ONPageXML -Title $((Get-Date -Year (Get-Date).Year -Month $month -Day $_).toString("dddd dd MMMM yyyy")) 76 | New-ONPage -URI $Section.pagesURL -Page $Page 77 | } 78 | } 79 | ``` 80 | It takes a couple of minutes, but that's much shorter than creating 12 month Sections and 365 day Pages by hand. 81 | 82 | This could just as easily be applied to lists of staff, students or objects in Active Directory. 83 | 84 | ## Use Case - Querying 85 | 86 | 87 | ```powershell 88 | Get-ONPages -Filter "parentNoteBook/displayname eq '2019' and startswith(title,'Monday')" 89 | ``` 90 | 91 | ## More use cases - see the Wiki 92 | 93 | [https://github.com/wightsci/OneNoteUtilitiesGraph/wiki](https://github.com/wightsci/OneNoteUtilitiesGraph/wiki) 94 | 95 | ## Future Developments 96 | 97 | * Support for Tags 98 | * HTML Templates for Pages 99 | * Merge-to-OneNote 100 | * Out-ONPage 101 | * New Graph REST features as they are released 102 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # Starter pipeline 2 | # Start with a minimal pipeline that you can customize to build and deploy your code. 3 | # Add steps that build, run tests, deploy, and more: 4 | # https://aka.ms/yaml 5 | 6 | trigger: 7 | - master 8 | 9 | pool: 10 | vmImage: 'windows-latest' 11 | 12 | steps: 13 | - script: echo Hello, world! 14 | displayName: 'Run a one-line script' 15 | 16 | - script: | 17 | echo Add other tasks to build, test, and deploy your project. 18 | echo See https://aka.ms/yaml 19 | displayName: 'Run a multi-line script' 20 | -------------------------------------------------------------------------------- /docs/Copy-ONPage.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Copy-ONPage 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ### page 16 | ``` 17 | Copy-ONPage [-Page ] [-DestinationId ] [] 18 | ``` 19 | 20 | ### id 21 | ``` 22 | Copy-ONPage [-Id ] [-DestinationId ] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | {{ Fill in the Description }} 27 | 28 | ## EXAMPLES 29 | 30 | ### Example 1 31 | ```powershell 32 | PS C:\> {{ Add example code here }} 33 | ``` 34 | 35 | {{ Add example description here }} 36 | 37 | ## PARAMETERS 38 | 39 | ### -DestinationId 40 | {{ Fill DestinationId Description }} 41 | 42 | ```yaml 43 | Type: String 44 | Parameter Sets: (All) 45 | Aliases: 46 | 47 | Required: False 48 | Position: Named 49 | Default value: None 50 | Accept pipeline input: False 51 | Accept wildcard characters: False 52 | ``` 53 | 54 | ### -Id 55 | {{ Fill Id Description }} 56 | 57 | ```yaml 58 | Type: String 59 | Parameter Sets: id 60 | Aliases: 61 | 62 | Required: False 63 | Position: Named 64 | Default value: None 65 | Accept pipeline input: False 66 | Accept wildcard characters: False 67 | ``` 68 | 69 | ### -Page 70 | {{ Fill Page Description }} 71 | 72 | ```yaml 73 | Type: Object 74 | Parameter Sets: page 75 | Aliases: 76 | 77 | Required: False 78 | Position: Named 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### CommonParameters 85 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 86 | 87 | ## INPUTS 88 | 89 | ### None 90 | 91 | ## OUTPUTS 92 | 93 | ### System.Object 94 | ## NOTES 95 | 96 | ## RELATED LINKS 97 | -------------------------------------------------------------------------------- /docs/Copy-ONSection.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Copy-ONSection 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Copy-ONSection [[-DestinationId] ] [[-Id] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> {{ Add example code here }} 27 | ``` 28 | 29 | {{ Add example description here }} 30 | 31 | ## PARAMETERS 32 | 33 | ### -DestinationId 34 | {{ Fill DestinationId Description }} 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 0 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -Id 49 | {{ Fill Id Description }} 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: 1 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ### None 69 | 70 | ## OUTPUTS 71 | 72 | ### System.Object 73 | ## NOTES 74 | 75 | ## RELATED LINKS 76 | -------------------------------------------------------------------------------- /docs/Copy-ONSectionGroup.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Copy-ONSectionGroup 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Copy-ONSectionGroup [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> {{ Add example code here }} 27 | ``` 28 | 29 | {{ Add example description here }} 30 | 31 | ## PARAMETERS 32 | 33 | ### CommonParameters 34 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 35 | 36 | ## INPUTS 37 | 38 | ### None 39 | 40 | ## OUTPUTS 41 | 42 | ### System.Object 43 | ## NOTES 44 | 45 | ## RELATED LINKS 46 | -------------------------------------------------------------------------------- /docs/Get-ONAccessToken.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONAccessToken 9 | 10 | ## SYNOPSIS 11 | Gets an Access Token from the Microsoft Graph API 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-ONAccessToken [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Gets an Access Token from the Microsoft Graph API. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-ONAccessToken 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### CommonParameters 32 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 33 | 34 | ## INPUTS 35 | 36 | ## OUTPUTS 37 | 38 | ## NOTES 39 | 40 | ## RELATED LINKS 41 | 42 | [Get-ONAuthCode](Get-ONAuthCode.md) 43 | 44 | -------------------------------------------------------------------------------- /docs/Get-ONAuthCode.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONAuthCode 9 | 10 | ## SYNOPSIS 11 | Gets an Authorization code from the Microsoft Graph API 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-ONAuthCode [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Gets an Authorization code from the Microsoft Graph API. 21 | If necessary, displays a web form for the user to authorize access to OneNote 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Get-ONAuthCode 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### CommonParameters 33 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 34 | 35 | ## INPUTS 36 | 37 | ## OUTPUTS 38 | 39 | ## NOTES 40 | 41 | ## RELATED LINKS 42 | 43 | [Get-ONAccessToken](Get-ONAccessToken.md) 44 | 45 | -------------------------------------------------------------------------------- /docs/Get-ONConfig.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONConfig 9 | 10 | ## SYNOPSIS 11 | Gets configuration information from a file. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-ONConfig [[-Path] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Gets configuration information for this module from a file. 21 | The results are stored in the global $settings variable. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Get-ONConfig 28 | ``` 29 | 30 | This command loads settings from a file at the default location. 31 | 32 | ### EXAMPLE 2 33 | ``` 34 | Get-ONConfig -Path .\OneNoteUtilities.config 35 | ``` 36 | 37 | This command loads settings from a file at the specified location. 38 | 39 | ## PARAMETERS 40 | 41 | ### -Path 42 | The path to the file. 43 | 44 | ```yaml 45 | Type: String 46 | Parameter Sets: (All) 47 | Aliases: 48 | 49 | Required: False 50 | Position: 0 51 | Default value: $HOME\.config\OneNoteUtilities.config 52 | Accept pipeline input: False 53 | Accept wildcard characters: False 54 | ``` 55 | 56 | ### CommonParameters 57 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 58 | 59 | ## INPUTS 60 | 61 | ## OUTPUTS 62 | 63 | ## NOTES 64 | 65 | ## RELATED LINKS 66 | 67 | [Save-ONConfig](Save-ONConfig.md) 68 | 69 | -------------------------------------------------------------------------------- /docs/Get-ONDefaultSection.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONDefaultSection 9 | 10 | ## SYNOPSIS 11 | Gets the default OneNote Section for new content. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-ONDefaultSection [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Gets the default OneNote Section for new content. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-ONDefaultSection 27 | 28 | id : 0-816F7725BEF00A5F!1079 29 | self : https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!1079 30 | createdDateTime : 2013-06-20T16:43:35.257Z 31 | displayName : Unfiled Notes 32 | lastModifiedDateTime : 2019-06-25T17:11:11.467Z 33 | isDefault : True 34 | pagesUrl : https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!1079/pages 35 | createdBy : @{user=} 36 | lastModifiedBy : @{user=} 37 | parentNotebook@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sections('0-816F7725BEF00A5F%211079')/parentNotebook/$entity 38 | parentNotebook : @{id=0-816F7725BEF00A5F!1078; displayName=Main NoteBook; self=https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!1078} 39 | parentSectionGroup@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sections('0-816F7725BEF00A5F%211079')/parentSectionGroup/$entity 40 | parentSectionGroup : 41 | ``` 42 | 43 | ## PARAMETERS 44 | 45 | ### CommonParameters 46 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 47 | 48 | ## INPUTS 49 | 50 | ### None 51 | You cannot pipe to this cmdlet. 52 | 53 | ## OUTPUTS 54 | 55 | ### PSCustomObject 56 | Representing a Graph Section resource. 57 | 58 | ## NOTES 59 | 60 | ## RELATED LINKS 61 | 62 | [New-ONPage](New-ONPage.md) 63 | 64 | [New-ONPageXML](New-ONPageXML) 65 | 66 | -------------------------------------------------------------------------------- /docs/Get-ONElement.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONElement 9 | 10 | ## SYNOPSIS 11 | Gets an element from a OneNote Page. 12 | 13 | ## SYNTAX 14 | 15 | ### data-id 16 | ``` 17 | Get-ONElement [-Page] -DataId [] 18 | ``` 19 | 20 | ### id 21 | ``` 22 | Get-ONElement [-Page] [-Id] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Gets an element from a OneNote Page. 27 | Returned as an XML element. 28 | 29 | ## EXAMPLES 30 | 31 | ### EXAMPLE 1 32 | ```powershell 33 | $page = Get-ONPage -uri 'https://graph.microsoft.com/v1.0/users/me/onenote/pages/0-bf55e9873b624c5c98d779f0e9f6e6d1!51-816F7725BEF00A5F!665031' | Get-ONPageXML 34 | Get-ONElement -page $page -id 'p:{ebb53e77-c34a-4a11-ad64-7c7fff9d7562}{35}' 35 | 36 | id style #text 37 | -- ----- ----- 38 | p:{ebb53e77-c34a-4a11-ad64-7c7fff9d7562}{35} margin-top:0pt;margin-bottom:0pt For quizzes and tests, you can track the items that students either get consistently wrong or consistently correct. 39 | You can eve... 40 | ``` 41 | 42 | This command obtains the content of a Page and stores it in the variable $page. 43 | Get-ONElement is then used to return a particular paragraph element. 44 | 45 | ## PARAMETERS 46 | 47 | ### -Id 48 | The Id of the page element. 49 | 50 | ```yaml 51 | Type: String 52 | Parameter Sets: id 53 | Aliases: 54 | 55 | Required: True 56 | Position: 1 57 | Default value: None 58 | Accept pipeline input: False 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### -Page 63 | The page hosting the element. Can be a page metadata object returned by **Get-ONPage** 64 | or an XmlDocument object returned by **Get-ONPageXML**. 65 | 66 | ```yaml 67 | Type: Object 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: True 72 | Position: 2 73 | Default value: None 74 | Accept pipeline input: True (ByValue) 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -DataId 79 | The data-id attribute of the element to be retrieved. 80 | 81 | ```yaml 82 | Type: String 83 | Parameter Sets: data-id 84 | Aliases: 85 | 86 | Required: True 87 | Position: Named 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### CommonParameters 94 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 95 | 96 | ## INPUTS 97 | 98 | ### [PSCustomObject], [XmlDocument] 99 | You can pipe an XHTML Page resource to this cmdlet, such as the output from **Get-ONPageXML**, or a page metadata object. 100 | 101 | ## OUTPUTS 102 | 103 | ### An XMLElement object. 104 | ## NOTES 105 | 106 | ## RELATED LINKS 107 | 108 | [Get-ONPage](Get-ONPage.md) 109 | 110 | [Get-ONPageXML](Get-ONPageXML.md) 111 | 112 | [Get-ONPages](Get-ONPages.md) 113 | 114 | -------------------------------------------------------------------------------- /docs/Get-ONItem.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONItem 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ### uri 16 | ``` 17 | Get-ONItem [-uri ] [] 18 | ``` 19 | 20 | ### id 21 | ``` 22 | Get-ONItem [-ItemType ] [-Id ] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | {{ Fill in the Description }} 27 | 28 | ## EXAMPLES 29 | 30 | ### Example 1 31 | ```powershell 32 | PS C:\> {{ Add example code here }} 33 | ``` 34 | 35 | {{ Add example description here }} 36 | 37 | ## PARAMETERS 38 | 39 | ### -Id 40 | {{ Fill Id Description }} 41 | 42 | ```yaml 43 | Type: String 44 | Parameter Sets: id 45 | Aliases: 46 | 47 | Required: False 48 | Position: Named 49 | Default value: None 50 | Accept pipeline input: False 51 | Accept wildcard characters: False 52 | ``` 53 | 54 | ### -ItemType 55 | {{ Fill ItemType Description }} 56 | 57 | ```yaml 58 | Type: String 59 | Parameter Sets: id 60 | Aliases: 61 | 62 | Required: False 63 | Position: Named 64 | Default value: None 65 | Accept pipeline input: False 66 | Accept wildcard characters: False 67 | ``` 68 | 69 | ### -uri 70 | {{ Fill uri Description }} 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: uri 75 | Aliases: 76 | 77 | Required: False 78 | Position: Named 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### CommonParameters 85 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 86 | 87 | ## INPUTS 88 | 89 | ### None 90 | 91 | ## OUTPUTS 92 | 93 | ### System.Object 94 | ## NOTES 95 | 96 | ## RELATED LINKS 97 | -------------------------------------------------------------------------------- /docs/Get-ONItems.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONItems 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ### uri 16 | ``` 17 | Get-ONItems [-List] [-Filter ] [-uri ] [] 18 | ``` 19 | 20 | ### type 21 | ``` 22 | Get-ONItems [-List] [-ItemType ] [-Filter ] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | {{ Fill in the Description }} 27 | 28 | ## EXAMPLES 29 | 30 | ### Example 1 31 | ```powershell 32 | PS C:\> {{ Add example code here }} 33 | ``` 34 | 35 | {{ Add example description here }} 36 | 37 | ## PARAMETERS 38 | 39 | ### -Filter 40 | {{ Fill Filter Description }} 41 | 42 | ```yaml 43 | Type: String 44 | Parameter Sets: (All) 45 | Aliases: 46 | 47 | Required: False 48 | Position: Named 49 | Default value: None 50 | Accept pipeline input: False 51 | Accept wildcard characters: False 52 | ``` 53 | 54 | ### -ItemType 55 | {{ Fill ItemType Description }} 56 | 57 | ```yaml 58 | Type: String 59 | Parameter Sets: type 60 | Aliases: 61 | Accepted values: notebooks, sectiongroups, sections, pages 62 | 63 | Required: False 64 | Position: Named 65 | Default value: None 66 | Accept pipeline input: False 67 | Accept wildcard characters: False 68 | ``` 69 | 70 | ### -List 71 | {{ Fill List Description }} 72 | 73 | ```yaml 74 | Type: SwitchParameter 75 | Parameter Sets: (All) 76 | Aliases: 77 | 78 | Required: False 79 | Position: Named 80 | Default value: None 81 | Accept pipeline input: False 82 | Accept wildcard characters: False 83 | ``` 84 | 85 | ### -uri 86 | {{ Fill uri Description }} 87 | 88 | ```yaml 89 | Type: String 90 | Parameter Sets: uri 91 | Aliases: 92 | 93 | Required: False 94 | Position: Named 95 | Default value: None 96 | Accept pipeline input: False 97 | Accept wildcard characters: False 98 | ``` 99 | 100 | ### CommonParameters 101 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 102 | 103 | ## INPUTS 104 | 105 | ### None 106 | 107 | ## OUTPUTS 108 | 109 | ### System.Object 110 | ## NOTES 111 | 112 | ## RELATED LINKS 113 | -------------------------------------------------------------------------------- /docs/Get-ONNoteBook.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONNoteBook 9 | 10 | ## SYNOPSIS 11 | Gets a OneNote NoteBook. 12 | 13 | ## SYNTAX 14 | 15 | ### uri 16 | ``` 17 | Get-ONNoteBook -Uri [] 18 | ``` 19 | 20 | ### id 21 | ``` 22 | Get-ONNoteBook -Id [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Gets a OneNote NoteBook. 27 | Returns notebook metadata. 28 | 29 | ## EXAMPLES 30 | 31 | ### EXAMPLE 1 32 | ``` 33 | Get-ONNoteBook -Id 0-816F7725BEF00A5F!665025 34 | 35 | @odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/notebooks/$entity 36 | id : 0-816F7725BEF00A5F!665025 37 | self : https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!665025 38 | createdDateTime : 2016-10-29T07:43:00.693Z 39 | displayName : Real World Samples 40 | lastModifiedDateTime : 2016-10-29T07:44:42.977Z 41 | isDefault : False 42 | userRole : Owner 43 | isShared : False 44 | sectionsUrl : https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!665025/sections 45 | sectionGroupsUrl : https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!665025/sectionGroups 46 | createdBy : @{user=} 47 | lastModifiedBy : @{user=} 48 | links : @{oneNoteClientUrl=; oneNoteWebUrl=} 49 | ``` 50 | 51 | ## PARAMETERS 52 | 53 | ### -Id 54 | The Id of the NoteBook to be retreived. 55 | 56 | ```yaml 57 | Type: String 58 | Parameter Sets: id 59 | Aliases: 60 | 61 | Required: True 62 | Position: Named 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -Uri 69 | The Uri of the NoteBook to be retreived. 70 | 71 | ```yaml 72 | Type: String 73 | Parameter Sets: uri 74 | Aliases: 75 | 76 | Required: True 77 | Position: Named 78 | Default value: None 79 | Accept pipeline input: False 80 | Accept wildcard characters: False 81 | ``` 82 | 83 | ### CommonParameters 84 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 85 | 86 | ## INPUTS 87 | 88 | ### Any object with an 'Id' property. 89 | ## OUTPUTS 90 | 91 | ### PSCustomObject representing a Graph NoteBook resource. 92 | ## NOTES 93 | 94 | ## RELATED LINKS 95 | 96 | [Get-ONNoteBooks]() 97 | 98 | -------------------------------------------------------------------------------- /docs/Get-ONNoteBooks.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONNoteBooks 9 | 10 | ## SYNOPSIS 11 | Gets a list of OneNote NoteBooks. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-ONNoteBooks [[-Filter] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Gets a list of OneNote NoteBooks matching the supplied filter or at the given URL. 21 | If no filter is supplied then all NoteBooks will be returned. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Get-ONNotebooks "displayname eq 'Real World Samples'" 28 | 29 | id : 0-816F7725BEF00A5F!665025 30 | self : https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!665025 31 | createdDateTime : 2016-10-29T07:43:00.693Z 32 | displayName : Real World Samples 33 | lastModifiedDateTime : 2016-10-29T07:44:42.977Z 34 | isDefault : False 35 | userRole : Owner 36 | isShared : False 37 | sectionsUrl : https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!665025/sections 38 | sectionGroupsUrl : https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!665025/sectionGroups 39 | createdBy : @{user=} 40 | lastModifiedBy : @{user=} 41 | links : @{oneNoteClientUrl=; oneNoteWebUrl=} 42 | ``` 43 | 44 | ## PARAMETERS 45 | 46 | ### -Filter 47 | An ***OData*** filter used to determine which NoteBooks are returned. 48 | 49 | ```yaml 50 | Type: String 51 | Parameter Sets: (All) 52 | Aliases: 53 | 54 | Required: False 55 | Position: 1 56 | Default value: None 57 | Accept pipeline input: False 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### CommonParameters 62 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 63 | 64 | ## INPUTS 65 | 66 | ### None 67 | You cannot pipe to this cmdlet. 68 | 69 | ## OUTPUTS 70 | 71 | ### [PSCustomObject[]] 72 | A collection of PSCustomObjects representing Graph NoteBook resources. 73 | 74 | ## NOTES 75 | 76 | ## RELATED LINKS 77 | 78 | [Get-ONNoteBook](Get-ONNoteBook.md) 79 | 80 | -------------------------------------------------------------------------------- /docs/Get-ONPage.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONPage 9 | 10 | ## SYNOPSIS 11 | Gets a OneNote Page. 12 | 13 | ## SYNTAX 14 | 15 | ### uri 16 | ``` 17 | Get-ONPage -Uri [] 18 | ``` 19 | 20 | ### id 21 | ``` 22 | Get-ONPage -Id [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Gets a OneNote Page. 27 | 28 | ## EXAMPLES 29 | 30 | ### EXAMPLE 1 31 | ``` 32 | Get-ONPage -Uri 'https://graph.microsoft.com/v1.0/users/me/onenote/pages/0-bf55e9873b624c5c98d779f0e9f6e6d1!51-816F7725BEF00A5F!665031' 33 | 34 | @odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/pages/$entity 35 | id : 0-bf55e9873b624c5c98d779f0e9f6e6d1!51-816F7725BEF00A5F!665031 36 | self : https://graph.microsoft.com/v1.0/users/me/onenote/pages/0-bf55e9873b624c5c98d779f0e9f6e6d1!51-816F7725BEF00A5F!665031 37 | createdDateTime : 2008-05-27T22:37:57Z 38 | title : ePortfolio 39 | createdByAppId : 40 | contentUrl : https://graph.microsoft.com/v1.0/users/me/onenote/pages/0-bf55e9873b624c5c98d779f0e9f6e6d1!51-816F7725BEF00A5F!665031/content 41 | lastModifiedDateTime : 2014-04-04T22:19:15Z 42 | links : @{oneNoteClientUrl=; oneNoteWebUrl=} 43 | parentSection@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/pages('0-bf55e9873b624c5c98d779f0e9f6e6d1%2151-816F7725BEF00A5F%21665031')/parentSection/$entity 44 | parentSection : @{id=0-816F7725BEF00A5F!665031; displayName=Other Education Examples; self=https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!665031} 45 | ``` 46 | 47 | This command gets a specific page by its URL. 48 | 49 | ### EXAMPLE 2 50 | ``` 51 | Get-ONPage -id '0-bf55e9873b624c5c98d779f0e9f6e6d1!49-816F7725BEF00A5F!665031' 52 | 53 | @odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/pages/$entity 54 | id : 0-bf55e9873b624c5c98d779f0e9f6e6d1!49-816F7725BEF00A5F!665031 55 | self : https://graph.microsoft.com/v1.0/users/me/onenote/pages/0-bf55e9873b624c5c98d779f0e9f6e6d1!49-816F7725BEF00A5F!665031 56 | createdDateTime : 2008-04-14T15:04:35Z 57 | title : Courses Delivered in OneNote 58 | createdByAppId : 59 | contentUrl : https://graph.microsoft.com/v1.0/users/me/onenote/pages/0-bf55e9873b624c5c98d779f0e9f6e6d1!49-816F7725BEF00A5F!665031/content 60 | lastModifiedDateTime : 2014-10-24T02:57:51Z 61 | links : @{oneNoteClientUrl=; oneNoteWebUrl=} 62 | parentSection@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/pages('0-bf55e9873b624c5c98d779f0e9f6e6d1%2149-816F7725BEF00A5F%21665031')/parentSection/$entity 63 | parentSection : @{id=0-816F7725BEF00A5F!665031; displayName=Other Education Examples; self=https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!665031} 64 | ``` 65 | 66 | This command gets a specific page by its Id. 67 | 68 | ## PARAMETERS 69 | 70 | ### -Id 71 | The Id of the page to be retrieved. 72 | 73 | ```yaml 74 | Type: String 75 | Parameter Sets: id 76 | Aliases: 77 | 78 | Required: True 79 | Position: Named 80 | Default value: None 81 | Accept pipeline input: True (ByPropertyName) 82 | Accept wildcard characters: False 83 | ``` 84 | 85 | ### -Uri 86 | The Uri of the page to be retrieved. 87 | 88 | ```yaml 89 | Type: String 90 | Parameter Sets: uri 91 | Aliases: 92 | 93 | Required: True 94 | Position: Named 95 | Default value: None 96 | Accept pipeline input: False 97 | Accept wildcard characters: False 98 | ``` 99 | 100 | ### CommonParameters 101 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 102 | 103 | ## INPUTS 104 | 105 | ### [Object] 106 | Any object with an 'ID' property. 107 | 108 | ## OUTPUTS 109 | 110 | ### PSCustomObject 111 | Representing a Graph Page resource. 112 | 113 | ## NOTES 114 | 115 | ## RELATED LINKS 116 | 117 | [Get-ONPageXML]() 118 | 119 | [Get-ONPages]() 120 | 121 | -------------------------------------------------------------------------------- /docs/Get-ONPagePreview.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONPagePreview 9 | 10 | ## SYNOPSIS 11 | Gets the Graph-generated preview content for a Page. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-ONPagePreview [-Id] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Gets the Graph-generated preview content for a Page, given its ID 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | $page = Get-ONPages -Filter "title eq 'Project Zero Work List'" 27 | Get-ONPagePreview -id $page.id 28 | 29 | @odata.context previewText 30 | -------------- ----------- 31 | https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.onenotePagePreview Implementation needs to be completed b... 32 | ``` 33 | 34 | ## PARAMETERS 35 | 36 | ### -Id 37 | The ID of the Page 38 | 39 | ```yaml 40 | Type: String 41 | Parameter Sets: (All) 42 | Aliases: 43 | 44 | Required: True 45 | Position: 1 46 | Default value: None 47 | Accept pipeline input: True (ByPropertyName) 48 | Accept wildcard characters: False 49 | ``` 50 | 51 | ### CommonParameters 52 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 53 | 54 | ## INPUTS 55 | 56 | ### [Object] 57 | Any object having an *ID* property. 58 | 59 | ## OUTPUTS 60 | 61 | ### PSCustomObject 62 | Containing preview text and a link to an image, if available 63 | 64 | ## NOTES 65 | 66 | ## RELATED LINKS 67 | 68 | [Get-ONPages](Get-ONPages.md) 69 | 70 | [Get-ONPage](Get-ONPage.md) 71 | 72 | -------------------------------------------------------------------------------- /docs/Get-ONPageXML.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONPageXML 9 | 10 | ## SYNOPSIS 11 | Gets the XHTML source of a OneNote Page. 12 | 13 | ## SYNTAX 14 | 15 | ### page 16 | ``` 17 | Get-ONPageXML [-Page] [-AsText] [] 18 | ``` 19 | 20 | ### id 21 | ``` 22 | Get-ONPageXML -Id [-AsText] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Gets the XHTML source of a OneNote Page. 27 | This cmdlet automatically requests element IDs to aid in page updates. 28 | 29 | ## EXAMPLES 30 | 31 | ### EXAMPLE 1 32 | ``` 33 | Get-ONPage -uri 'https://graph.microsoft.com/v1.0/users/me/onenote/pages/0-bf55e9873b624c5c98d779f0e9f6e6d1!51-816F7725BEF00A5F!665031' | Get-ONPageXML | Select-Object -Expand OuterXml 34 | 35 | 36 | 37 | ePortfolio 38 | 39 | 40 | 41 |
42 |

OneNote makes it easy to track student progress in one notebook. 43 | You can easily track items like homework, quizzes, and tests for all your students. 44 | Some teachers create a notebook for each student in the class. 45 | Then they can put homework, quizzes, tests and even a copies of a group project into this ePortfolio. 46 |

47 |
48 |

For quizzes and tests, you can track the items that students either get consistently wrong or consistently correct. 49 | You can even keep copies of the student's completed quizzes or tests in case you want to refer to them later. 50 |

51 |
52 | 53 |
54 | 55 | 56 | ``` 57 | 58 | This command pipes a Page object to **Get-ONPageXML**. 59 | Expanding the 'html' property displays the full XHTML of the page. 60 | 61 | ### EXAMPLE 2 62 | ``` 63 | $page = Get-ONPage -uri ' https://graph.microsoft.com/v1.0/users/me/onenote/pages/0-bf55e9873b624c5c98d779f0e9f6e6d1!51-816F7725BEF00A5F!665031' | Get-ONPageXML 64 | $page.GetElementsByTagName('p') 65 | 66 | id style #text 67 | -- ----- ----- 68 | p:{ebb53e77-c34a-4a11-ad64-7c7fff9d7562}{34} margin-top:0pt;margin-bottom:0pt {OneNote makes it easy to , in one notebook. 69 | You can easily track items like , , , , and ...} 70 | p:{ebb53e77-c34a-4a11-ad64-7c7fff9d7562}{35} margin-top:0pt;margin-bottom:0pt For quizzes and tests, you can track the items that students either get consistently wrong or consistently correct. 71 | You can eve... 72 | ``` 73 | 74 | This command pipes a Page object to **Get-ONPageXML** and stores the result in the variable $page. 75 | $page can then be accessed as an XMLDocument object. 76 | 77 | ### EXAMPLE 3 78 | ``` 79 | Get-ONPage -uri ' https://graph.microsoft.com/v1.0/users/me/onenote/pages/0-bf55e9873b624c5c98d779f0e9f6e6d1!51-816F7725BEF00A5F!665031' | Get-ONPageXML -AsText 80 | 81 | 82 | ePortfolio 83 | 84 | 85 | 86 |
87 |

OneNote makes it easy to track student progress in one notebook. You can easily track items like homework, quizzes, and tests for all your students. Some teachers create a notebook for each student in the class. Then they can put homework, quizzes, tests and even a copies of a group project 90 | into this ePortfolio.

91 |
92 |

For quizzes and tests, you can track the items that students either get consistently 93 | wrong or consistently correct. You can even keep copies of the student's completed quizzes or tests in case you want to refer to them later.

94 |
95 | 98 |
99 | 100 | 101 | ``` 102 | 103 | This command pipes a page object to **Get-ONPageXML**. The -AsText switch means that the output is a string rather than an XML document. 104 | 105 | ### EXAMPLE 4 106 | ``` 107 | Get-ONPageXML -Id 0-bf55e9873b624c5c98d779f0e9f6e6d1!51-816F7725BEF00A5F!665031' -AsText 108 | 109 | 110 | 111 | ePortfolio 112 | 113 | 114 | 115 |
116 |

OneNote makes it 117 | easy to track student progress 118 | in one notebook. You can easily track items like homework, quizzes, and tests for all your 120 | students. Some teachers create a notebook for each student in the class. Then they can put homework, 121 | quizzes, tests and even a copies of a group project into this ePortfolio.


122 |

For quizzes and 123 | tests, you can track the items that students either get consistently wrong or consistently correct. You can 124 | even keep copies of the student's completed quizzes or tests in case you want to refer to them later.

125 |
130 |
131 | 132 | 133 | ``` 134 | 135 | This command retrieves the content of a page using **Get-ONPageXML** and the Id parameter. The -AsText switch means that the output is a string rather than an XML document. 136 | 137 | ### EXAMPLE 5 138 | ``` 139 | Get-ONPageXML -Id '0-bf55e9873b624c5c98d779f0e9f6e6d1!51-816F7725BEF00A5F!665031' 140 | 141 | html 142 | ---- 143 | html 144 | ``` 145 | 146 | This command retrieves the content of a page using **Get-ONPageXML** and the Id parameter. The result is a System.Xml.XmlDocument object. You would normally store this in a variable for further processing. 147 | 148 | ## PARAMETERS 149 | 150 | ### -Page 151 | A OneNote Page object. 152 | Must have a 'contentURL' property. 153 | 154 | ```yaml 155 | Type: Object 156 | Parameter Sets: page 157 | Aliases: 158 | 159 | Required: True 160 | Position: 1 161 | Default value: None 162 | Accept pipeline input: True (ByValue) 163 | Accept wildcard characters: False 164 | ``` 165 | 166 | ### -AsText 167 | A switch parameter, that if supplied, tells the cmdlet to output the page content a text, rather than an XMLDocument object. 168 | 169 | ```yaml 170 | Type: SwitchParameter 171 | Parameter Sets: (All) 172 | Aliases: 173 | 174 | Required: False 175 | Position: Named 176 | Default value: False 177 | Accept pipeline input: False 178 | Accept wildcard characters: False 179 | ``` 180 | 181 | ### -Id 182 | The Id of the page you wish to retrieve the content of. 183 | 184 | ```yaml 185 | Type: String 186 | Parameter Sets: id 187 | Aliases: 188 | 189 | Required: True 190 | Position: Named 191 | Default value: None 192 | Accept pipeline input: True (ByValue) 193 | Accept wildcard characters: False 194 | ``` 195 | 196 | ### CommonParameters 197 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 198 | 199 | ## INPUTS 200 | 201 | ### [PSCustomObject] 202 | Representing a Page resource. Must have a 'contentURL' property. 203 | 204 | ## OUTPUTS 205 | 206 | ### XMLDocument 207 | XHTML document object 208 | 209 | ### String 210 | 211 | ## NOTES 212 | 213 | ## RELATED LINKS 214 | 215 | [Get-ONPage]() 216 | 217 | [Get-ONPages]() 218 | 219 | [Get-ONElement]() 220 | 221 | -------------------------------------------------------------------------------- /docs/Get-ONPages.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONPages 9 | 10 | ## SYNOPSIS 11 | Gets a list of OneNote Pages matching the given Filter, or found at the given URL. 12 | 13 | ## SYNTAX 14 | 15 | ### filter 16 | ``` 17 | Get-ONPages -Filter [] 18 | ``` 19 | 20 | ### uri 21 | ``` 22 | Get-ONPages [-Uri ] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Gets a list of OneNote Pages matching the given Filter or found at the given URL. 27 | If no filter or URL is provided all Pages in all NoteBooks will be returned. 28 | The filter should be valid OData. 29 | The information returned is the standard set of Graph metadata for a Page object. 30 | 31 | ## EXAMPLES 32 | 33 | ### EXAMPLE 1 34 | ``` 35 | Get-ONPages -Filter "startswith(title,'OneNote')" | Select-Object Id,Title 36 | 37 | id title 38 | -- ----- 39 | 0-1f9aa8a73e9a4f14b4daa7762b5aa530!42-816F7725BEF00A5F!665027 OneNote Class Notebooks 40 | 0-634cb14d92da4a1c85ca21fccb057cf7!39-816F7725BEF00A5F!665030 OneNote in Education Resources 41 | 0-8d3847e53f7d452aaddc4f63814b8d59!11-816F7725BEF00A5F!1079 OneNote Clipper Installation 42 | 0-bf55e9873b624c5c98d779f0e9f6e6d1!21-816F7725BEF00A5F!665031 OneNote and Learning Styles 43 | ``` 44 | 45 | This command gets a list of pages whose Title starts with 'OneNote'. 46 | 47 | ### EXAMPLE 2 48 | ``` 49 | Get-ONPages -Uri 'https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!665031/pages' | Select-Object Id,Title 50 | 51 | id title 52 | -- ----- 53 | 0-bf55e9873b624c5c98d779f0e9f6e6d1!44-816F7725BEF00A5F!665031 Other Learning Activities 54 | 0-bf55e9873b624c5c98d779f0e9f6e6d1!60-816F7725BEF00A5F!665031 Facilitator Guides 55 | 0-bf55e9873b624c5c98d779f0e9f6e6d1!54-816F7725BEF00A5F!665031 Self-Paced Teacher Development 56 | 0-bf55e9873b624c5c98d779f0e9f6e6d1!49-816F7725BEF00A5F!665031 Courses Delivered in OneNote 57 | 0-bf55e9873b624c5c98d779f0e9f6e6d1!57-816F7725BEF00A5F!665031 New Teacher Orientation 58 | 0-bf55e9873b624c5c98d779f0e9f6e6d1!28-816F7725BEF00A5F!665031 Teacher Workbooks 59 | 0-bf55e9873b624c5c98d779f0e9f6e6d1!17-816F7725BEF00A5F!665031 Example Lesson Plans 60 | 0-bf55e9873b624c5c98d779f0e9f6e6d1!63-816F7725BEF00A5F!665031 How OneNote Enhances Different Learning Styles 61 | 0-bf55e9873b624c5c98d779f0e9f6e6d1!21-816F7725BEF00A5F!665031 OneNote and Learning Styles 62 | 0-bf55e9873b624c5c98d779f0e9f6e6d1!46-816F7725BEF00A5F!665031 Variety of Education and Learning Examples 63 | 0-bf55e9873b624c5c98d779f0e9f6e6d1!51-816F7725BEF00A5F!665031 ePortfolio 64 | ``` 65 | 66 | This command gets a list of Pages found at a specific URL. 67 | 68 | ## PARAMETERS 69 | 70 | ### -Filter 71 | The filter to use for the Page list. OData. 72 | 73 | ```yaml 74 | Type: String 75 | Parameter Sets: filter 76 | Aliases: 77 | 78 | Required: True 79 | Position: Named 80 | Default value: None 81 | Accept pipeline input: False 82 | Accept wildcard characters: False 83 | ``` 84 | 85 | ### -Uri 86 | The URL from which to retrieve Pages. 87 | 88 | ```yaml 89 | Type: String 90 | Parameter Sets: uri 91 | Aliases: 92 | 93 | Required: False 94 | Position: Named 95 | Default value: None 96 | Accept pipeline input: False 97 | Accept wildcard characters: False 98 | ``` 99 | 100 | ### CommonParameters 101 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 102 | 103 | ## INPUTS 104 | 105 | ### None 106 | You cannot pipe to this cmdlet. 107 | 108 | ## OUTPUTS 109 | 110 | ### [PSCustomObject[]] 111 | Collection representing Graph Page resources. 112 | 113 | ## NOTES 114 | 115 | ## RELATED LINKS 116 | 117 | [Get-ONPage](Get-ONPage.md) 118 | 119 | [Get-ONPageXML](Get-ONPageXML) 120 | 121 | -------------------------------------------------------------------------------- /docs/Get-ONRecentNoteBooks.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONRecentNoteBooks 9 | 10 | ## SYNOPSIS 11 | Gets the list of most recently accessed OneNote Notebooks. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-ONRecentNoteBooks [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Gets the list of most recently accessed OneNote Notebooks. 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ``` 26 | PS C:\> Get-ONRecentNoteBooks 27 | 28 | displayName lastAccessedTime sourceService links 29 | ----------- ---------------- ------------- ----- 30 | Work Notebook 2019-06-27T11:33:55Z OneDrive @{oneNoteClientUrl=; oneNoteWebUrl=} 31 | API NoteBook 2019-06-26T13:50:46Z OneDrive @{oneNoteClientUrl=; oneNoteWebUrl=} 32 | Personal 2019-06-26T10:34:08Z OneDrive @{oneNoteClientUrl=; oneNoteWebUrl=} 33 | WebNotes 2019-06-22T17:08:12Z OneDrive @{oneNoteClientUrl=; oneNoteWebUrl=} 34 | Real World Samples 2018-10-17T14:17:23Z OneDrive @{oneNoteClientUrl=; oneNoteWebUrl=} 35 | Holiday 2018-10-17T14:17:10Z OneDrive @{oneNoteClientUrl=; oneNoteWebUrl=} 36 | Main Notebook 2017-05-08T13:14:40Z OneDrive @{oneNoteClientUrl=; oneNoteWebUrl=} 37 | Class Notebook 2016-01-21T15:15:31Z OneDrive @{oneNoteClientUrl=; oneNoteWebUrl=} 38 | ``` 39 | 40 | This command displays the most recently accessed NoteBooks for the logged-on user. 41 | 42 | ## PARAMETERS 43 | 44 | ### CommonParameters 45 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 46 | 47 | ## INPUTS 48 | 49 | ## OUTPUTS 50 | 51 | ## NOTES 52 | 53 | ## RELATED LINKS 54 | -------------------------------------------------------------------------------- /docs/Get-ONResource.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONResource 9 | 10 | ## SYNOPSIS 11 | Saves a OneNote Resource to a file. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-ONResource -Uri -Path [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | This cmdlet retrieves a binary resource (image, file) from OneNote and saves it in a file. 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ``` 26 | PS C:\> {{ Add example code here }} 27 | ``` 28 | 29 | {{ Add example description here }} 30 | 31 | ## PARAMETERS 32 | 33 | ### -Path 34 | The path to save the file to. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: Named 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -Uri 49 | The URL of the Resource. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: Named 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ### None 69 | ## OUTPUTS 70 | 71 | ### System.Object 72 | ## NOTES 73 | 74 | ## RELATED LINKS 75 | -------------------------------------------------------------------------------- /docs/Get-ONSection.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONSection 9 | 10 | ## SYNOPSIS 11 | Gets a OneNote Section. 12 | 13 | ## SYNTAX 14 | 15 | ### uri 16 | ``` 17 | Get-ONSection -Uri [] 18 | ``` 19 | 20 | ### id 21 | ``` 22 | Get-ONSection -Id [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Gets a OneNote Section, based on its ID or URL. 27 | 28 | ## EXAMPLES 29 | 30 | ### Example 1 31 | ``` 32 | PS C:\> Get-ONSection -ID '0-816F7725BEF00A5F!665030' 33 | 34 | @odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sections/$entity 35 | id : 0-816F7725BEF00A5F!665030 36 | self : https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!665030 37 | createdDateTime : 2016-10-29T07:43:06.16Z 38 | displayName : K-4 Japanese Tree Frog 39 | lastModifiedDateTime : 2016-10-29T07:43:10.177Z 40 | isDefault : False 41 | pagesUrl : https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!665030/pages 42 | createdBy : @{user=} 43 | lastModifiedBy : @{user=} 44 | parentNotebook@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sections('0-816F7725BEF00A5F%21665030')/parentNotebook/$entity 45 | parentNotebook : @{id=0-816F7725BEF00A5F!665025; displayName=Real World Samples; self=https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!665025} 46 | parentSectionGroup@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sections('0-816F7725BEF00A5F%21665030')/parentSectionGroup/$entity 47 | parentSectionGroup : 48 | ``` 49 | 50 | This command retrieves a specific Section based on its ID. 51 | 52 | ### Example 2 53 | ``` 54 | PS C:\> Get-ONSection -uri 'https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!665030' 55 | 56 | 57 | @odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sections/$entity 58 | id : 0-816F7725BEF00A5F!665030 59 | self : https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!665030 60 | createdDateTime : 2016-10-29T07:43:06.16Z 61 | displayName : K-4 Japanese Tree Frog 62 | lastModifiedDateTime : 2016-10-29T07:43:10.177Z 63 | isDefault : False 64 | pagesUrl : https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!665030/pages 65 | createdBy : @{user=} 66 | lastModifiedBy : @{user=} 67 | parentNotebook@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sections('0-816F7725BEF00A5F%21665030')/parentNotebook/$entity 68 | parentNotebook : @{id=0-816F7725BEF00A5F!665025; displayName=Real World Samples; self=https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!665025} 69 | parentSectionGroup@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sections('0-816F7725BEF00A5F%21665030')/parentSectionGroup/$entity 70 | parentSectionGroup : 71 | ``` 72 | 73 | This command retrieves a specific Section based on its URL. 74 | 75 | ## PARAMETERS 76 | 77 | ### -Id 78 | The ID of the section to be retrieved. 79 | 80 | ```yaml 81 | Type: String 82 | Parameter Sets: id 83 | Aliases: 84 | 85 | Required: True 86 | Position: Named 87 | Default value: None 88 | Accept pipeline input: True (ByPropertyName) 89 | Accept wildcard characters: False 90 | ``` 91 | 92 | ### -Uri 93 | The Url of the section to be retreived. 94 | 95 | ```yaml 96 | Type: String 97 | Parameter Sets: uri 98 | Aliases: 99 | 100 | Required: True 101 | Position: Named 102 | Default value: None 103 | Accept pipeline input: False 104 | Accept wildcard characters: False 105 | ``` 106 | 107 | ### CommonParameters 108 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 109 | 110 | ## INPUTS 111 | 112 | ### [Object] 113 | With an 'ID' property 114 | 115 | ## OUTPUTS 116 | 117 | ### PSCustomObject 118 | Representing a Graph 'Section' resource. 119 | 120 | ## NOTES 121 | 122 | ## RELATED LINKS 123 | 124 | [Get-ONSections](Get-ONSections.md) 125 | 126 | -------------------------------------------------------------------------------- /docs/Get-ONSectionGroup.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONSectionGroup 9 | 10 | ## SYNOPSIS 11 | Gets a OneNote SectionGroup. 12 | 13 | ## SYNTAX 14 | 15 | ### uri 16 | ``` 17 | Get-ONSectionGroup -Uri [] 18 | ``` 19 | 20 | ### id 21 | ``` 22 | Get-ONSectionGroup -Id [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Gets a OneNote SectionGroup using its URI or ID. 27 | 28 | ## EXAMPLES 29 | 30 | ### EXAMPLE 1 31 | ``` 32 | Get-ONSectionGroup -Id 0-816F7725BEF00A5F!731386 33 | 34 | @odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sectionGroups/$entity 35 | id : 0-816F7725BEF00A5F!731386 36 | self : https://graph.microsoft.com/v1.0/users/me/onenote/sectionGroups/0-816F7725BEF00A5F!731386 37 | createdDateTime : 2019-02-28T10:50:52.52Z 38 | displayName : Work 39 | lastModifiedDateTime : 2019-06-19T15:19:45.667Z 40 | sectionsUrl : https://graph.microsoft.com/v1.0/users/me/onenote/sectionGroups/0-816F7725BEF00A5F!731386/sections 41 | sectionGroupsUrl : https://graph.microsoft.com/v1.0/users/me/onenote/sectionGroups/0-816F7725BEF00A5F!731386/sectionGroups 42 | createdBy : @{user=} 43 | lastModifiedBy : @{user=} 44 | parentNotebook@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sectionGroups('0-816F7725BEF00A5F%21731386')/parentNotebook/$entity 45 | parentNotebook : @{id=0-816F7725BEF00A5F!1273; displayName=Stuart's Notebook; 46 | self=https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!1273} 47 | parentSectionGroup@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sectionGroups('0-816F7725BEF00A5F%21731386')/parentSectionGroup/$entity 48 | parentSectionGroup : 49 | ``` 50 | 51 | ## PARAMETERS 52 | 53 | ### -Id 54 | The Id of the SectionGroup to be retrieved. 55 | 56 | ```yaml 57 | Type: String 58 | Parameter Sets: id 59 | Aliases: 60 | 61 | Required: True 62 | Position: Named 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -Uri 69 | The Uri of the SectionGroup to be retrieved. 70 | 71 | ```yaml 72 | Type: String 73 | Parameter Sets: uri 74 | Aliases: 75 | 76 | Required: True 77 | Position: Named 78 | Default value: None 79 | Accept pipeline input: False 80 | Accept wildcard characters: False 81 | ``` 82 | 83 | ### CommonParameters 84 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 85 | 86 | ## INPUTS 87 | 88 | ### [Object] 89 | With an 'ID' property. 90 | 91 | ## OUTPUTS 92 | 93 | ### PSCustomObject 94 | Representing a Graph 'SectionGroup' resource. 95 | 96 | ## NOTES 97 | 98 | ## RELATED LINKS 99 | 100 | [Get-ONSectionGroups]() 101 | 102 | -------------------------------------------------------------------------------- /docs/Get-ONSectionGroups.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONSectionGroups 9 | 10 | ## SYNOPSIS 11 | Gets a list of OneNote Section Groups matching the supplied filter. 12 | 13 | ## SYNTAX 14 | 15 | ### filter 16 | ``` 17 | Get-ONSectionGroups [-Filter] [] 18 | ``` 19 | 20 | ### uri 21 | ``` 22 | Get-ONSectionGroups [-Uri ] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Gets a list of OneNote Section Groups matching the supplied filter, or at the supplied URL. 27 | If no filter is supplied, all SectionGroups in all NoteBooks will be returned. 28 | The filter must be vaild OData. 29 | 30 | ## EXAMPLES 31 | 32 | ### Example 1 33 | ``` 34 | PS C:\> Get-ONSectiongroups -Filter "displayname eq 'Work'" 35 | 36 | id : 0-816F7725BEF00A5F!731386 37 | self : https://graph.microsoft.com/v1.0/users/me/onenote/sectionGroups/0-816F7725BEF00A5F!731386 38 | createdDateTime : 2019-02-28T10:50:52.52Z 39 | displayName : Work 40 | lastModifiedDateTime : 2019-06-27T10:14:26.947Z 41 | sectionsUrl : https://graph.microsoft.com/v1.0/users/me/onenote/sectionGroups/0-816F7725BEF00A5F!731386/sections 42 | sectionGroupsUrl : https://graph.microsoft.com/v1.0/users/me/onenote/sectionGroups/0-816F7725BEF00A5F!731386/sectionGroups 43 | createdBy : @{user=} 44 | lastModifiedBy : @{user=} 45 | parentNotebook@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sectionGroups('0-816F7725BEF00A5F%21731386')/parentNotebook/$entity 46 | parentNotebook : @{id=0-816F7725BEF00A5F!1273; displayName=Stuart's Notebook; self=https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!1273} 47 | parentSectionGroup@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sectionGroups('0-816F7725BEF00A5F%21731386')/parentSectionGroup/$entity 48 | parentSectionGroup : 49 | ``` 50 | 51 | This command gets the SectionGroup whose name is 'Work'. 52 | 53 | ## PARAMETERS 54 | 55 | ### -Filter 56 | The filter to be used. 57 | Must be valid OData 58 | 59 | ```yaml 60 | Type: String 61 | Parameter Sets: filter 62 | Aliases: 63 | 64 | Required: True 65 | Position: 1 66 | Default value: None 67 | Accept pipeline input: False 68 | Accept wildcard characters: False 69 | ``` 70 | 71 | ### -Uri 72 | The URL from which to retrieve SectionGroups. 73 | 74 | ```yaml 75 | Type: String 76 | Parameter Sets: uri 77 | Aliases: 78 | 79 | Required: False 80 | Position: Named 81 | Default value: None 82 | Accept pipeline input: False 83 | Accept wildcard characters: False 84 | ``` 85 | 86 | ### CommonParameters 87 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 88 | 89 | ## INPUTS 90 | 91 | ### None 92 | You cannot pipe to this cmdlet. 93 | 94 | ## OUTPUTS 95 | 96 | ### [PSCustomObject[]] 97 | Collection of PSCustomObjects representing Graph SectionGroup Resources. 98 | 99 | ## NOTES 100 | 101 | ## RELATED LINKS 102 | 103 | [Get-ONSectionGroup](Get-ONSectionGroup.md) 104 | 105 | [Get-ONSections](Get-ONSections.md) 106 | 107 | [Get-ONSection](Get-ONSection.md) 108 | 109 | -------------------------------------------------------------------------------- /docs/Get-ONSections.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONSections 9 | 10 | ## SYNOPSIS 11 | Gets a list of OneNote Sections matching the supplied filter, or at the supplied URL. 12 | If no filter or URL is supplied then all Sections in all NoteBooks will be returned. 13 | 14 | ## SYNTAX 15 | 16 | ### filter 17 | ``` 18 | Get-ONSections [-Filter] [] 19 | ``` 20 | 21 | ### uri 22 | ``` 23 | Get-ONSections [-Uri ] [] 24 | ``` 25 | 26 | ## DESCRIPTION 27 | Gets a list of OneNote Sections matching the supplied filter. 28 | If no filter is supplied then all Sections are returned. 29 | The filter must be valid OData syntax. 30 | 31 | ## EXAMPLES 32 | 33 | ### EXAMPLE 1 34 | ``` 35 | Get-ONSections "displayname eq 'Other Education Examples'" 36 | 37 | id : 0-816F7725BEF00A5F!665031 38 | self : https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!665031 39 | createdDateTime : 2016-10-29T07:43:06.21Z 40 | displayName : Other Education Examples 41 | lastModifiedDateTime : 2016-10-29T07:43:09.35Z 42 | isDefault : False 43 | pagesUrl : https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!665031/pages 44 | createdBy : @{user=} 45 | lastModifiedBy : @{user=} 46 | parentNotebook@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sections('0-816F7725BEF00A5F%21665031')/parentNotebook/$entity 47 | parentNotebook : @{id=0-816F7725BEF00A5F!665025; displayName=Real World Samples; 48 | self=https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!665025} 49 | parentSectionGroup@odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sections('0-816F7725BEF00A5F%21665031')/parentSectionGroup/$entity 50 | parentSectionGroup : 51 | ``` 52 | 53 | ## PARAMETERS 54 | 55 | ### -Filter 56 | The filter to be used. OData. 57 | 58 | ```yaml 59 | Type: String 60 | Parameter Sets: filter 61 | Aliases: 62 | 63 | Required: True 64 | Position: 1 65 | Default value: None 66 | Accept pipeline input: False 67 | Accept wildcard characters: False 68 | ``` 69 | 70 | ### -Uri 71 | The URL from which to retieve Sections. 72 | 73 | ```yaml 74 | Type: String 75 | Parameter Sets: uri 76 | Aliases: 77 | 78 | Required: False 79 | Position: Named 80 | Default value: None 81 | Accept pipeline input: False 82 | Accept wildcard characters: False 83 | ``` 84 | 85 | ### CommonParameters 86 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 87 | 88 | ## INPUTS 89 | 90 | ## OUTPUTS 91 | 92 | ### [PSCustomObject[]] 93 | Collection of PSCustomObjects representing Graph Section resources. 94 | 95 | ## NOTES 96 | 97 | ## RELATED LINKS 98 | 99 | [Get-ONSection](Get-ONSection.md) 100 | 101 | -------------------------------------------------------------------------------- /docs/Get-ONSessionVariables.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONSessionVariables 9 | 10 | ## SYNOPSIS 11 | Gets a set of useful variable values. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-ONSessionVariables [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Gets some variable values. Useful in monitoring/debugging. 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> Get-ONSessionVariables 27 | ``` 28 | 29 | ## PARAMETERS 30 | 31 | ### CommonParameters 32 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 33 | 34 | ## INPUTS 35 | 36 | ### None 37 | ## OUTPUTS 38 | 39 | ### System.Object 40 | ## NOTES 41 | 42 | ## RELATED LINKS 43 | -------------------------------------------------------------------------------- /docs/Get-ONTableAsObject.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONTableAsObject 9 | 10 | ## SYNOPSIS 11 | Converts a Table from a OneNote Page into a PSCustomObject array 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-ONTableAsObject [-Table] [-NoHeaders] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Converts a Table from a OneNote Page into a PSCustomObject array. This would then be suitable for export to another format. 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> Get-ONPages -Filter "title eq 'Data Page'" | Get-ONElement -DataId 'myTable' | Get-ONTableAsObject 27 | 28 | Alpha Bravo Charlie 29 | ----- ----- ------- 30 | One Two Three 31 | Four Five Six 32 | ... ... ... 33 | ``` 34 | 35 | This example retrieves an XML table with the data id 'myTable' using **Get-ONElement** and converts it into a PSCustomobject array. 36 | 37 | ### Example 2 38 | ```powershell 39 | PS C:\> Get-ONPages -Filter "title eq 'Data Page'" | Get-ONElement -DataId 'myTable' | Get-ONTableAsObject | Export-CSV -Path .\myTable.csv -NoTypeInformation 40 | PS C:\> Get-Content .\myTable.csv 41 | "Alpha","Bravo","Charlie" 42 | "One","Two","Three" 43 | "Four","Five","Six" 44 | " "," "," " 45 | ``` 46 | 47 | This example retrieves an XML table with the data id 'myTable' using **Get-ONElement** and converts it into a PSCustomobject array and exports it to a CSV file using **Export-CSV**. 48 | 49 | ## PARAMETERS 50 | 51 | ### -NoHeaders 52 | Identifies that the table does not contain a first row of column headings. The columns will be 53 | named Column 1 .. Column *n* as required. 54 | 55 | ```yaml 56 | Type: SwitchParameter 57 | Parameter Sets: (All) 58 | Aliases: 59 | 60 | Required: False 61 | Position: Named 62 | Default value: None 63 | Accept pipeline input: False 64 | Accept wildcard characters: False 65 | ``` 66 | 67 | ### -Table 68 | An XML representation of a table as returned by **Get-ONElement.** 69 | 70 | ```yaml 71 | Type: Object 72 | Parameter Sets: (All) 73 | Aliases: 74 | 75 | Required: True 76 | Position: 0 77 | Default value: None 78 | Accept pipeline input: True (ByValue) 79 | Accept wildcard characters: False 80 | ``` 81 | 82 | ### CommonParameters 83 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 84 | 85 | ## INPUTS 86 | 87 | ### XMLElement 88 | Representing an HTML table as XML. 89 | 90 | ## OUTPUTS 91 | 92 | ### System.Object 93 | Representation of the table as a PSCustomObject array. 94 | 95 | ## NOTES 96 | 97 | ## RELATED LINKS 98 | 99 | [Get-ONElement](Get-ONElement.md) -------------------------------------------------------------------------------- /docs/Get-ONTokenStatus.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-ONTokenStatus 9 | 10 | ## SYNOPSIS 11 | Checks for presence of Auth Code and Access Token. 12 | 13 | If not present or expired then requests new. 14 | 15 | ## SYNTAX 16 | 17 | ``` 18 | Get-ONTokenStatus [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | This function maintains a valid set of Graph credentials, comprising an Authorization Code and an Access Token. 23 | 24 | TYpically this function is called before any access is attempted to the Graph API itself. 25 | 26 | ## EXAMPLES 27 | 28 | ### Example 1 29 | ``` 30 | PS C:\> Get-ONTokenStatus 31 | ``` 32 | 33 | ## PARAMETERS 34 | 35 | ### CommonParameters 36 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 37 | 38 | ## INPUTS 39 | 40 | ## OUTPUTS 41 | 42 | ## NOTES 43 | 44 | ## RELATED LINKS 45 | 46 | [Get-ONAuthCode]() 47 | 48 | [Get-ONAccessToken]() 49 | 50 | -------------------------------------------------------------------------------- /docs/Invoke-ONApp.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Invoke-ONApp 9 | 10 | ## SYNOPSIS 11 | Invokes the default handler for onenote: URLs and loads a page. 12 | 13 | ## SYNTAX 14 | 15 | ### page (Default) 16 | ``` 17 | Invoke-ONApp [-Page] [] 18 | ``` 19 | 20 | ### id 21 | ``` 22 | Invoke-ONApp [-Id] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Invokes the default application for handling 'onenote:' URLs and passes it the URL of a page to load, based on an ID or a Page object. 27 | 28 | ## EXAMPLES 29 | 30 | ### Example 1 31 | ```powershell 32 | PS C:\> Invoke-ONApp -Page (Get-ONPages -Filter "title eq '2 - Life Cycle of Tree Frog'") 33 | ``` 34 | 35 | This command uses **Get-ONPages** to obtain a Page object matching the filter, and this is passed to **Invoke-ONApp** 36 | 37 | ### Example 2 38 | ```powershell 39 | PS C:\> Invoke-ONApp -ID ' 0-634cb14d92da4a1c85ca21fccb057cf7!40-816F7725BEF00A5F!665030' 40 | ``` 41 | 42 | This command opens a Page based on its ID. 43 | 44 | ## PARAMETERS 45 | 46 | ### -Id 47 | The ID of the page to be loaded. 48 | 49 | ```yaml 50 | Type: String 51 | Parameter Sets: id 52 | Aliases: 53 | 54 | Required: True 55 | Position: 0 56 | Default value: None 57 | Accept pipeline input: False 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### -Page 62 | A Page object to be loaded. 63 | 64 | ```yaml 65 | Type: Object 66 | Parameter Sets: page 67 | Aliases: 68 | 69 | Required: True 70 | Position: 0 71 | Default value: None 72 | Accept pipeline input: False 73 | Accept wildcard characters: False 74 | ``` 75 | 76 | ### CommonParameters 77 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 78 | 79 | ## INPUTS 80 | 81 | ### None 82 | 83 | ## OUTPUTS 84 | 85 | ### None 86 | ## NOTES 87 | 88 | ## RELATED LINKS 89 | -------------------------------------------------------------------------------- /docs/Invoke-ONDesktop.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Invoke-ONDesktop 9 | 10 | ## SYNOPSIS 11 | Invokes the Office 365 OneNote application and loads a page. 12 | 13 | ## SYNTAX 14 | 15 | ### page (Default) 16 | ``` 17 | Invoke-ONDesktop [-Page] [] 18 | ``` 19 | 20 | ### id 21 | ``` 22 | Invoke-ONDesktop [-Id] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Invokes the Office 365 OneNote application and loads a page. This command specifically loads the *desktop* version of OneNote, rather than whichever application is registered with WIndows as the handler of the `onenote:` protocol. 27 | 28 | ## EXAMPLES 29 | 30 | ### Example 1 31 | ```powershell 32 | PS C:\> Invoke-ONDesktop -Page (Get-ONPages -Filter "title eq '2 - Life Cycle of Tree Frog'") 33 | ``` 34 | 35 | This command uses **Get-ONPages** to obtain a Page object matching the filter, and this is passed to **Invoke-ONDesktop** 36 | 37 | ### Example 2 38 | ```powershell 39 | PS C:\> Invoke-ONDesktop -ID ' 0-634cb14d92da4a1c85ca21fccb057cf7!40-816F7725BEF00A5F!665030' 40 | ``` 41 | 42 | ## PARAMETERS 43 | 44 | ### -Id 45 | The ID of the page to be loaded. 46 | 47 | ```yaml 48 | Type: String 49 | Parameter Sets: id 50 | Aliases: 51 | 52 | Required: True 53 | Position: 0 54 | Default value: None 55 | Accept pipeline input: False 56 | Accept wildcard characters: False 57 | ``` 58 | 59 | ### -Page 60 | A Page object to be loaded. 61 | 62 | ```yaml 63 | Type: Object 64 | Parameter Sets: page 65 | Aliases: 66 | 67 | Required: True 68 | Position: 0 69 | Default value: None 70 | Accept pipeline input: False 71 | Accept wildcard characters: False 72 | ``` 73 | 74 | ### CommonParameters 75 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 76 | 77 | ## INPUTS 78 | 79 | ### None 80 | 81 | ## OUTPUTS 82 | 83 | ### System.Object 84 | ## NOTES 85 | 86 | ## RELATED LINKS 87 | -------------------------------------------------------------------------------- /docs/Invoke-ONWeb.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Invoke-ONWeb 9 | 10 | ## SYNOPSIS 11 | Invokes the default web browser application and loads a page. 12 | 13 | ## SYNTAX 14 | 15 | ### page (Default) 16 | ``` 17 | Invoke-ONWeb -Page [] 18 | ``` 19 | 20 | ### Id 21 | ``` 22 | Invoke-ONWeb -Id [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Invokes the default application for handling web pages and passes it the URL of a page to load, based on an ID or a Page object. 27 | 28 | ## EXAMPLES 29 | 30 | ### Example 1 31 | ``` 32 | PS C:\> Invoke-ONWeb -Page (Get-ONPages -Filter "title eq '2 - Life Cycle of Tree Frog'") 33 | ``` 34 | 35 | This command uses **Get-ONPages** to obtain a Page object matching the filter, and this is passed to **Invoke-ONWeb** 36 | 37 | ### Example 2 38 | ``` 39 | PS C:\> Invoke-ONWeb -ID ' 0-634cb14d92da4a1c85ca21fccb057cf7!40-816F7725BEF00A5F!665030' 40 | ``` 41 | 42 | This command opens a Page based on its ID. 43 | 44 | ## PARAMETERS 45 | 46 | ### -Id 47 | The ID of the Page to be loaded. 48 | 49 | ```yaml 50 | Type: String 51 | Parameter Sets: Id 52 | Aliases: 53 | 54 | Required: True 55 | Position: Named 56 | Default value: None 57 | Accept pipeline input: False 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### -Page 62 | A Page object to be loaded. 63 | 64 | ```yaml 65 | Type: Object 66 | Parameter Sets: page 67 | Aliases: 68 | 69 | Required: True 70 | Position: Named 71 | Default value: None 72 | Accept pipeline input: False 73 | Accept wildcard characters: False 74 | ``` 75 | 76 | ### CommonParameters 77 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 78 | 79 | ## INPUTS 80 | 81 | ### None 82 | 83 | ## OUTPUTS 84 | 85 | ### None 86 | ## NOTES 87 | 88 | ## RELATED LINKS 89 | 90 | [Invoke-ONApp](Invoke-ONApp.md) -------------------------------------------------------------------------------- /docs/New-ONElement.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-ONElement 9 | 10 | ## SYNOPSIS 11 | Creates a new OneNote page element. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-ONElement [-Type] [[-Document] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Creates a new OneNote page element. This cmdlet can be used to create elements for new Pages generated by **New-ONPageXML**. 21 | If no document object is supplied then a temporary System.XML.XMLDocument object is created. 22 | 23 | ## EXAMPLES 24 | 25 | ### Example 1 26 | ``` 27 | PS C:\> $div = New-ONElement -Type div 28 | PS C:\> $div.InnerText = "Hello" 29 | PS C:\> $div.OuterXML 30 |
Hello
31 | ``` 32 | 33 | In this example a div element is created and its text value set. Note that a 'lang' attribute has been added. 34 | 35 | ## PARAMETERS 36 | 37 | ### -Type 38 | The type of element to create. Possible values: 39 | 40 | - head 41 | - body 42 | - title 43 | - meta 44 | - h1 45 | - h2 46 | - h3 47 | - h4 48 | - h5 49 | - h6 50 | - p 51 | - ul 52 | - ol 53 | - li 54 | - pre 55 | - b 56 | - i 57 | - table 58 | - tr 59 | - td 60 | - div 61 | - span 62 | - img 63 | - br 64 | - cite 65 | 66 | ```yaml 67 | Type: String 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: True 72 | Position: 1 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -Document 79 | The document object in which to create the new element. 80 | 81 | ```yaml 82 | Type: Object 83 | Parameter Sets: (All) 84 | Aliases: 85 | 86 | Required: False 87 | Position: 2 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### CommonParameters 94 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 95 | 96 | ## INPUTS 97 | 98 | ## OUTPUTS 99 | 100 | ## NOTES 101 | 102 | ## RELATED LINKS 103 | -------------------------------------------------------------------------------- /docs/New-ONHTMLItem.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-ONHTMLItem 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-ONHTMLItem [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> {{ Add example code here }} 27 | ``` 28 | 29 | {{ Add example description here }} 30 | 31 | ## PARAMETERS 32 | 33 | ### CommonParameters 34 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 35 | 36 | ## INPUTS 37 | 38 | ### None 39 | 40 | ## OUTPUTS 41 | 42 | ### System.Object 43 | ## NOTES 44 | 45 | ## RELATED LINKS 46 | -------------------------------------------------------------------------------- /docs/New-ONJSONItem.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-ONJSONItem 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-ONJSONItem [[-Hashtable] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> {{ Add example code here }} 27 | ``` 28 | 29 | {{ Add example description here }} 30 | 31 | ## PARAMETERS 32 | 33 | ### -Hashtable 34 | {{ Fill Hashtable Description }} 35 | 36 | ```yaml 37 | Type: Object 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 0 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### CommonParameters 49 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 50 | 51 | ## INPUTS 52 | 53 | ### None 54 | 55 | ## OUTPUTS 56 | 57 | ### System.Object 58 | ## NOTES 59 | 60 | ## RELATED LINKS 61 | -------------------------------------------------------------------------------- /docs/New-ONNoteBook.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-ONNoteBook 9 | 10 | ## SYNOPSIS 11 | Creates a new OneNote NoteBook. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-ONNoteBook [-DisplayName] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Creates a new OneNote NoteBook. 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ``` 26 | PS C:\> New-ONNoteBook -DisplayName 'Class NoteBook' 27 | 28 | @odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/notebooks/$entity 29 | id : 0-816F7725BEF00A5F!731579 30 | self : https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!731579 31 | createdDateTime : 2019-06-27T13:47:17.66Z 32 | displayName : Class NoteBook 33 | lastModifiedDateTime : 2019-06-27T13:47:17.66Z 34 | isDefault : False 35 | userRole : Owner 36 | isShared : False 37 | sectionsUrl : https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!731579/sections 38 | sectionGroupsUrl : https://graph.microsoft.com/v1.0/users/me/onenote/notebooks/0-816F7725BEF00A5F!731579/sectionGroups 39 | createdBy : @{user=} 40 | lastModifiedBy : @{user=} 41 | links : @{oneNoteClientUrl=; oneNoteWebUrl=} 42 | ``` 43 | 44 | This command creates a new NoteBook named 'Class NoteBook' 45 | 46 | ## PARAMETERS 47 | 48 | ### -DisplayName 49 | The name for the new NoteBook. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 1 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ### None 69 | You cannot pipe to this cmdlet. 70 | 71 | ## OUTPUTS 72 | 73 | ### [PSCustomObject] 74 | Representing the new Graph NoteBook resource. 75 | 76 | ## NOTES 77 | 78 | ## RELATED LINKS 79 | -------------------------------------------------------------------------------- /docs/New-ONPage.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-ONPage 9 | 10 | ## SYNOPSIS 11 | Creates a new OneNote Page. 12 | 13 | ## SYNTAX 14 | 15 | ### page 16 | ``` 17 | New-ONPage [-Uri ] -Page [] 18 | ``` 19 | 20 | ### html 21 | ``` 22 | New-ONPage [-Uri ] -Html [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Creates a new OneNote Page. 27 | 28 | ## EXAMPLES 29 | 30 | ### Example 1 31 | ``` 32 | PS C:\> $p = New-ONPageXML -Title 'Lesson 1' 33 | PS C:\> New-ONPage -URI 'https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!731583/pages' -page $p 34 | 35 | @odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sections('0-816F7725BEF00A5F%21731583')/pages/$entity 36 | id : 0-b9b9988092b24ac0bb14d4953f88ca2f!61-816F7725BEF00A5F!731583 37 | self : https://graph.microsoft.com/v1.0/users/me/onenote/pages/0-b9b9988092b24ac0bb14d4953f88ca2f!61-816F7725BEF00A5F!731583 38 | createdDateTime : 2019-06-27T15:17:35.9924696Z 39 | title : Lesson 1 40 | createdByAppId : WLID-00000000441C65F3 41 | contentUrl : https://graph.microsoft.com/v1.0/users/me/onenote/pages/0-b9b9988092b24ac0bb14d4953f88ca2f!61-816F7725BEF00A5F!731583/content 42 | lastModifiedDateTime : 2019-06-27T15:17:35.9924696Z 43 | links : @{oneNoteClientUrl=; oneNoteWebUrl=} 44 | ``` 45 | 46 | This example shows the creation of an XHTML page using **New-ONPageXML** that is then passed to **New-ONPage** for creation in the Graph service. 47 | 48 | ## PARAMETERS 49 | 50 | ### -Page 51 | A Page object. 52 | 53 | ```yaml 54 | Type: Object 55 | Parameter Sets: page 56 | Aliases: 57 | 58 | Required: True 59 | Position: Named 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -Html 66 | The page content as valid XHTML. 67 | 68 | ```yaml 69 | Type: String 70 | Parameter Sets: html 71 | Aliases: 72 | 73 | Required: True 74 | Position: Named 75 | Default value: None 76 | Accept pipeline input: False 77 | Accept wildcard characters: False 78 | ``` 79 | 80 | ### -Uri 81 | The location to create the new Page. 82 | 83 | If no location is specified then the default location for new content is used. 84 | 85 | ```yaml 86 | Type: String 87 | Parameter Sets: (All) 88 | Aliases: 89 | 90 | Required: False 91 | Position: Named 92 | Default value: (Get-ONDefaultSection).pagesUrl 93 | Accept pipeline input: False 94 | Accept wildcard characters: False 95 | ``` 96 | 97 | ### CommonParameters 98 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 99 | 100 | ## INPUTS 101 | 102 | ## OUTPUTS 103 | 104 | ## NOTES 105 | 106 | ## RELATED LINKS 107 | 108 | [Get-ONDefaultSection](Get-ONDefaultSectionmd) 109 | 110 | [New-ONPageXML](New-ONPageXML.md) 111 | 112 | -------------------------------------------------------------------------------- /docs/New-ONPageXML.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-ONPageXML 9 | 10 | ## SYNOPSIS 11 | Creates the XHTML source for a new OneNote Page. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-ONPageXML [-Title] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Creates the XHTML source for a new OneNote Page. 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ``` 26 | PS C:\> New-ONPageXML -Title 'Timetable' 27 | 28 | html 29 | ---- 30 | html 31 | ``` 32 | 33 | This command outputs an XHTML object for an empty page with the title 'Timetable' 34 | 35 | ## PARAMETERS 36 | 37 | ### -Title 38 | The title for the new Page. 39 | 40 | ```yaml 41 | Type: String 42 | Parameter Sets: (All) 43 | Aliases: 44 | 45 | Required: True 46 | Position: 1 47 | Default value: None 48 | Accept pipeline input: False 49 | Accept wildcard characters: False 50 | ``` 51 | 52 | ### CommonParameters 53 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 54 | 55 | ## INPUTS 56 | 57 | ## OUTPUTS 58 | 59 | ### XMLDocument 60 | Object representing the new page. 61 | 62 | ## NOTES 63 | 64 | ## RELATED LINKS 65 | -------------------------------------------------------------------------------- /docs/New-ONSection.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-ONSection 9 | 10 | ## SYNOPSIS 11 | Creates a new OneNote Section. 12 | 13 | ## SYNTAX 14 | 15 | ### ByUri 16 | ``` 17 | New-ONSection -DisplayName -Uri [] 18 | ``` 19 | 20 | ### ByID 21 | ``` 22 | New-ONSection -DisplayName -Id [-SectionGroup] [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Creates a new OneNote Section. 27 | 28 | ## EXAMPLES 29 | 30 | ### Example 1 31 | ``` 32 | PS C:\> New-ONSection -DisplayName 'Monday' -Id 0-816F7725BEF00A5F!731581 -SectionGroup 33 | 34 | @odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/sectionGroups('0-816F7725BEF00A5F%21731581')/sections/$entity 35 | id : 0-816F7725BEF00A5F!731583 36 | self : https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!731583 37 | createdDateTime : 2019-06-27T14:06:46.343Z 38 | displayName : Monday 39 | lastModifiedDateTime : 2019-06-27T14:06:46.507Z 40 | isDefault : False 41 | pagesUrl : https://graph.microsoft.com/v1.0/users/me/onenote/sections/0-816F7725BEF00A5F!731583/pages 42 | createdBy : @{user=} 43 | lastModifiedBy : @{user=} 44 | ``` 45 | 46 | This command creates a new Section named 'Monday' in the SectionGroup with the listed ID. 47 | 48 | ## PARAMETERS 49 | 50 | ### -DisplayName 51 | The name for the new Section. 52 | 53 | ```yaml 54 | Type: String 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: True 59 | Position: Named 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -Id 66 | The ID of the destination container. 67 | If this is a SectionGroup, then the SectionGroup switch must also be used. 68 | 69 | ```yaml 70 | Type: String 71 | Parameter Sets: ByID 72 | Aliases: 73 | 74 | Required: True 75 | Position: Named 76 | Default value: None 77 | Accept pipeline input: False 78 | Accept wildcard characters: False 79 | ``` 80 | 81 | ### -SectionGroup 82 | Switch to identify that the ID parameter refers to a SectionGroup, not a Section. 83 | 84 | ```yaml 85 | Type: SwitchParameter 86 | Parameter Sets: ByID 87 | Aliases: 88 | 89 | Required: False 90 | Position: Named 91 | Default value: False 92 | Accept pipeline input: False 93 | Accept wildcard characters: False 94 | ``` 95 | 96 | ### -Uri 97 | The URL at which the new Section will be created. 98 | 99 | ```yaml 100 | Type: String 101 | Parameter Sets: ByUri 102 | Aliases: 103 | 104 | Required: True 105 | Position: Named 106 | Default value: None 107 | Accept pipeline input: False 108 | Accept wildcard characters: False 109 | ``` 110 | 111 | ### CommonParameters 112 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 113 | 114 | ## INPUTS 115 | 116 | ### None 117 | You cannot pipe to this cmdlet. 118 | 119 | ## OUTPUTS 120 | 121 | ### [PSCustomObject] 122 | Representing the new Graph Section resource. 123 | 124 | ## NOTES 125 | 126 | ## RELATED LINKS 127 | -------------------------------------------------------------------------------- /docs/New-ONSectionGroup.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-ONSectionGroup 9 | 10 | ## SYNOPSIS 11 | Creates a new OneNote SectionGroup. 12 | 13 | ## SYNTAX 14 | 15 | ### ByUri 16 | ``` 17 | New-ONSectionGroup -DisplayName -Uri [] 18 | ``` 19 | 20 | ### ByID 21 | ``` 22 | New-ONSectionGroup -DisplayName -Id [] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | Creates a new OneNote SectionGroup. 27 | 28 | ## EXAMPLES 29 | 30 | ### Example 1 31 | ``` 32 | PS C:\> New-ONSectionGroup -DisplayName 'Week 1' -Id '0-816F7725BEF00A5F!731579' 33 | 34 | @odata.context : https://graph.microsoft.com/v1.0/$metadata#users('me')/onenote/notebooks('0-816F7725BEF00A5F%21731579')/sectionGroups/$entity 35 | id : 0-816F7725BEF00A5F!731581 36 | self : https://graph.microsoft.com/v1.0/users/me/onenote/sectionGroups/0-816F7725BEF00A5F!731581 37 | createdDateTime : 2019-06-27T13:59:25.327Z 38 | displayName : Week 1 39 | lastModifiedDateTime : 2019-06-27T13:59:25.327Z 40 | sectionsUrl : https://graph.microsoft.com/v1.0/users/me/onenote/sectionGroups/0-816F7725BEF00A5F!731581/sections 41 | sectionGroupsUrl : https://graph.microsoft.com/v1.0/users/me/onenote/sectionGroups/0-816F7725BEF00A5F!731581/sectionGroups 42 | createdBy : @{user=} 43 | lastModifiedBy : @{user=} 44 | ``` 45 | 46 | This command creates a new SectionGroup in the NoteBook identified by the given ID. 47 | 48 | ## PARAMETERS 49 | 50 | ### -DisplayName 51 | The name for the new SectionGroup. 52 | 53 | ```yaml 54 | Type: String 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: True 59 | Position: Named 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -Id 66 | The ID of the container in which the SectionGroup will be created. 67 | 68 | ```yaml 69 | Type: String 70 | Parameter Sets: ByID 71 | Aliases: 72 | 73 | Required: True 74 | Position: Named 75 | Default value: None 76 | Accept pipeline input: False 77 | Accept wildcard characters: False 78 | ``` 79 | 80 | ### -Uri 81 | The URL at which the new SectionGroup will be created. 82 | 83 | ```yaml 84 | Type: String 85 | Parameter Sets: ByUri 86 | Aliases: 87 | 88 | Required: True 89 | Position: Named 90 | Default value: None 91 | Accept pipeline input: False 92 | Accept wildcard characters: False 93 | ``` 94 | 95 | ### CommonParameters 96 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 97 | 98 | ## INPUTS 99 | 100 | ### None 101 | You cannot pipe to this cmdlet. 102 | 103 | ## OUTPUTS 104 | 105 | ### [PSCustomObject] 106 | Representing the new Graph SectionGroup resource. 107 | 108 | ## NOTES 109 | 110 | ## RELATED LINKS 111 | -------------------------------------------------------------------------------- /docs/Remove-ONElement.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-ONElement 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-ONElement [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> {{ Add example code here }} 27 | ``` 28 | 29 | {{ Add example description here }} 30 | 31 | ## PARAMETERS 32 | 33 | ### CommonParameters 34 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 35 | 36 | ## INPUTS 37 | 38 | ### None 39 | 40 | ## OUTPUTS 41 | 42 | ### System.Object 43 | ## NOTES 44 | 45 | ## RELATED LINKS 46 | -------------------------------------------------------------------------------- /docs/Remove-ONNoteBook.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-ONNoteBook 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-ONNoteBook [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> {{ Add example code here }} 27 | ``` 28 | 29 | {{ Add example description here }} 30 | 31 | ## PARAMETERS 32 | 33 | ### CommonParameters 34 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 35 | 36 | ## INPUTS 37 | 38 | ### None 39 | 40 | ## OUTPUTS 41 | 42 | ### System.Object 43 | ## NOTES 44 | 45 | ## RELATED LINKS 46 | -------------------------------------------------------------------------------- /docs/Remove-ONPage.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-ONPage 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-ONPage [-Id] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> {{ Add example code here }} 27 | ``` 28 | 29 | {{ Add example description here }} 30 | 31 | ## PARAMETERS 32 | 33 | ### -Id 34 | {{ Fill Id Description }} 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 0 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### CommonParameters 49 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 50 | 51 | ## INPUTS 52 | 53 | ### None 54 | 55 | ## OUTPUTS 56 | 57 | ### System.Object 58 | ## NOTES 59 | 60 | ## RELATED LINKS 61 | -------------------------------------------------------------------------------- /docs/Remove-ONSection.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-ONSection 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-ONSection [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> {{ Add example code here }} 27 | ``` 28 | 29 | {{ Add example description here }} 30 | 31 | ## PARAMETERS 32 | 33 | ### CommonParameters 34 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 35 | 36 | ## INPUTS 37 | 38 | ### None 39 | 40 | ## OUTPUTS 41 | 42 | ### System.Object 43 | ## NOTES 44 | 45 | ## RELATED LINKS 46 | -------------------------------------------------------------------------------- /docs/Remove-ONSectionGroup.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-ONSectionGroup 9 | 10 | ## SYNOPSIS 11 | {{ Fill in the Synopsis }} 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-ONSectionGroup [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### Example 1 25 | ```powershell 26 | PS C:\> {{ Add example code here }} 27 | ``` 28 | 29 | {{ Add example description here }} 30 | 31 | ## PARAMETERS 32 | 33 | ### CommonParameters 34 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 35 | 36 | ## INPUTS 37 | 38 | ### None 39 | 40 | ## OUTPUTS 41 | 42 | ### System.Object 43 | ## NOTES 44 | 45 | ## RELATED LINKS 46 | -------------------------------------------------------------------------------- /docs/Save-ONConfig.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Save-ONConfig 9 | 10 | ## SYNOPSIS 11 | Saves the settings object to an XML file. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Save-ONConfig [[-path] ] [-Force] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Saves the settings object to an XML file, allowing storage of information not suitable for embedding in a script or module. 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Save-ONConfig -Force 27 | ``` 28 | 29 | This command saves the current configuration to the default location, overwriting the existing file, if it exists. 30 | 31 | ## PARAMETERS 32 | 33 | ### -Force 34 | Switch parameter to allow overwriting an existing file. 35 | 36 | ```yaml 37 | Type: SwitchParameter 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: Named 43 | Default value: False 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -path 49 | Defines the path to save the settings file to. 50 | Defaults to: 51 | 52 | $HOME\.config\OneNoteUtilities.config 53 | 54 | ```yaml 55 | Type: String 56 | Parameter Sets: (All) 57 | Aliases: 58 | 59 | Required: False 60 | Position: 0 61 | Default value: $HOME\.config\OneNoteUtilities.config 62 | Accept pipeline input: False 63 | Accept wildcard characters: False 64 | ``` 65 | 66 | ### CommonParameters 67 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 68 | 69 | ## INPUTS 70 | 71 | ## OUTPUTS 72 | 73 | ## NOTES 74 | 75 | ## RELATED LINKS 76 | 77 | [Get-ONConfig](Get-ONConfig.md) 78 | 79 | -------------------------------------------------------------------------------- /docs/Set-ONPageLevel.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-ONPageLevel 9 | 10 | ## SYNOPSIS 11 | Sets the page indentation level of a OneNote Page. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-ONPageLevel [-Id] [-Level] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Sets the page indentation level of a OneNote Page. 21 | Not applicable to the first Page in a Section. 22 | 23 | ## EXAMPLES 24 | 25 | ### Example 1 26 | ``` 27 | PS C:\> Set-ONPageLevel -ID '0-b9b9988092b24ac0bb14d4953f88ca2f!61-816F7725BEF00A5F!731583' -Level 1 28 | ``` 29 | 30 | This command indents the PageLevel of the given Page to level 1. 31 | This will only succeed if the Page is not the first one in the Section. 32 | 33 | ## PARAMETERS 34 | 35 | ### -Id 36 | The Id of the OneNote Page. 37 | 38 | ```yaml 39 | Type: String 40 | Parameter Sets: (All) 41 | Aliases: 42 | 43 | Required: True 44 | Position: 1 45 | Default value: None 46 | Accept pipeline input: False 47 | Accept wildcard characters: False 48 | ``` 49 | 50 | ### -Level 51 | The level for the page. 52 | Possible values: 53 | 54 | 0,1,2 55 | 56 | ```yaml 57 | Type: Object 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 2 63 | Default value: None 64 | Accept pipeline input: False 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### CommonParameters 69 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 70 | 71 | ## INPUTS 72 | 73 | ## OUTPUTS 74 | 75 | ## NOTES 76 | 77 | ## RELATED LINKS 78 | 79 | [Get-ONPage](Get-ONPage.md) 80 | 81 | -------------------------------------------------------------------------------- /docs/Test-ONUtilities.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Test-ONUtilities 9 | 10 | ## SYNOPSIS 11 | A Test suite that will excercise the capabilities of the module. 12 | Tied to the structure of the Author's NoteBooks :( 13 | 14 | ## SYNTAX 15 | 16 | ``` 17 | Test-ONUtilities [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | A Test suite that will excercise the capabilities of the module. 22 | Tied to the structure of the Author's NoteBooks :( . 23 | Running with the -Verbose switch provides diagnostic information. 24 | 25 | ## EXAMPLES 26 | 27 | ### Example 1 28 | ``` 29 | PS C:\> Test-ONUtilities 30 | ``` 31 | 32 | ## PARAMETERS 33 | 34 | ### CommonParameters 35 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 36 | 37 | ## INPUTS 38 | 39 | ### None 40 | ## OUTPUTS 41 | 42 | ### System.Object 43 | ## NOTES 44 | 45 | ## RELATED LINKS 46 | -------------------------------------------------------------------------------- /docs/Update-ONElement.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: OneNoteUtilitiesGraph-help.xml 3 | Module Name: OneNoteUtilitiesGraph 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Update-ONElement 9 | 10 | ## SYNOPSIS 11 | Updates a specified element on a OneNote Page. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Update-ONElement [-Id] [-TargetId] [-Action] [-Content] 17 | [[-Position] ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Updates a specified element on a OneNote Page, identified by its ID. 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ```PowerShell 27 | $page = Get-ONPages -Filter "title eq 'Project Zero Work List'" | Get-ONPageXML 28 | $page.OuterXML 29 | ``` 30 | 31 | ``` 32 | 33 | 34 | Project Zero Work List 35 | 36 | 37 | 38 | 39 |
40 |

Implementation needs to be completed by 1st July 2019

41 |
42 | 43 | 44 | ``` 45 | 46 | ```PowerShell 47 | Update-ONElement -TargetID 'p:{5071e2d9-b596-0397-0473-9e65c6a6ede6}{31}' -Id 0-3f5159c19028036127617e60b3e94771!1-816F7725BEF00A5F!1079 -action replace -content '

Implementation needs to be completed by 1st December 2019

' 48 | $page = Get-ONPages -Filter "title eq 'Project Zero Work List'" | Get-ONPageXML 49 | $page.OuterXML 50 | ``` 51 | 52 | ``` 53 | 54 | 55 | Project Zero Work List 56 | 57 | 58 | 59 | 60 |
61 |

Implementation needs to be completed by 1st December 2019

62 |
63 | 64 | 65 | ``` 66 | 67 | In this example we first retrieve the XML content of a page using Get-ONPages and Get-ONPageXML, then we update the content of a paragraph element. 68 | We then re-retrieve the page to check that the content has changed. 69 | Note that the Id of the paragraph is changed because we are replacing it. 70 | 71 | ## PARAMETERS 72 | 73 | ### -Id 74 | The ID of the page to be modified. 75 | 76 | ```yaml 77 | Type: String 78 | Parameter Sets: (All) 79 | Aliases: 80 | 81 | Required: True 82 | Position: 1 83 | Default value: None 84 | Accept pipeline input: False 85 | Accept wildcard characters: False 86 | ``` 87 | 88 | ### -Action 89 | The action to be undertaked. 90 | Possible values: replace, append, delete, insert, or prepend 91 | 92 | ```yaml 93 | Type: String 94 | Parameter Sets: (All) 95 | Aliases: 96 | 97 | Required: True 98 | Position: 3 99 | Default value: None 100 | Accept pipeline input: False 101 | Accept wildcard characters: False 102 | ``` 103 | 104 | ### -Content 105 | The XHTML content for the Action. 106 | 107 | ```yaml 108 | Type: String 109 | Parameter Sets: (All) 110 | Aliases: 111 | 112 | Required: True 113 | Position: 4 114 | Default value: None 115 | Accept pipeline input: False 116 | Accept wildcard characters: False 117 | ``` 118 | 119 | ### -Position 120 | The location of the content in relation to the target. 121 | Possible values: after (default) or before 122 | 123 | ```yaml 124 | Type: String 125 | Parameter Sets: (All) 126 | Aliases: 127 | 128 | Required: False 129 | Position: 5 130 | Default value: None 131 | Accept pipeline input: False 132 | Accept wildcard characters: False 133 | ``` 134 | 135 | ### -TargetId 136 | The ID of the Page element to be updated, or the 'body' or 'title' keyword. 137 | 138 | ```yaml 139 | Type: String 140 | Parameter Sets: (All) 141 | Aliases: 142 | 143 | Required: True 144 | Position: 2 145 | Default value: None 146 | Accept pipeline input: False 147 | Accept wildcard characters: False 148 | ``` 149 | 150 | ### CommonParameters 151 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 152 | 153 | ## INPUTS 154 | 155 | ## OUTPUTS 156 | 157 | ## NOTES 158 | 159 | ## RELATED LINKS 160 | 161 | [Get-ONPageXML](Get-ONPageXML.md) 162 | 163 | [Get-ONPages](Get-ONPages.md) 164 | 165 | [Get-ONPage](Get-ONPage) 166 | 167 | --------------------------------------------------------------------------------