--- name: onenote description: Read/write OneNote pages via Microsoft Graph or COM category: windows version: 1.0.0 platform: windows tags: onenote, notes, notebook, microsoft, graph, pages, sections license: Apache-2.0 --- # OneNote Access, create, and update OneNote notebooks, sections, and pages using PowerShell COM or Microsoft Graph API — capture meeting notes, append to journals, and query your knowledge base. ## When to Use - User wants to capture meeting notes or action items into OneNote - User asks to read a specific OneNote page or section - User wants to create a new page or append content to an existing one - User needs to list available notebooks and sections - User wants to search across OneNote pages ## How to Use ### List notebooks (Graph API) ```powershell $headers = @{ Authorization = "Bearer $env:GRAPH_TOKEN" } Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/me/onenote/notebooks" -Headers $headers | Select-Object -ExpandProperty value | Select-Object id, displayName, lastModifiedDateTime ``` ### List sections in a notebook ```powershell $notebookId = "YOUR_NOTEBOOK_ID" $headers = @{ Authorization = "Bearer $env:GRAPH_TOKEN" } Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/me/onenote/notebooks/$notebookId/sections" -Headers $headers | Select-Object -ExpandProperty value | Select-Object id, displayName ``` ### Get pages in a section ```powershell $sectionId = "YOUR_SECTION_ID" $headers = @{ Authorization = "Bearer $env:GRAPH_TOKEN" } Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/me/onenote/sections/$sectionId/pages" -Headers $headers | Select-Object -ExpandProperty value | Select-Object id, title, createdDateTime ``` ### Create a new page in a section ```powershell $sectionId = "YOUR_SECTION_ID" $headers = @{ Authorization = "Bearer $env:GRAPH_TOKEN" "Content-Type" = "application/xhtml+xml" } $html = @"
Action items: