Others

How to Access OneNote Page XML via Microsoft Graph API

Phi Hung VoPhi Hung Vo Oct 10, 2026 869 views

Question details

The user needs to retrieve and parse OneNote page content, specifically its HTML or XML representation including table elements, using the Microsoft Graph API.

How to Access OneNote Page XML Through the Microsoft Graph API
Product
Microsoft Graph API / OneNote
Device & OS
not provided
Scenario
Integrating OneNote with custom applications or scripts to programmatically extract page content such as tables.
Observed behavior
The goal is to successfully fetch the unique page ID and parse the returned XML/HTML structure.
Before you start

Ensure you have registered your application in the Microsoft Entra admin center and obtained the necessary OneNote API permissions, such as Notes.Read or Notes.ReadWrite.

Solution 1Recommended

Retrieve OneNote Page Content via Microsoft Graph API

Use the Microsoft Graph endpoint to fetch the specific OneNote page's HTML or XML representation by targeting its unique page ID.

Microsoft Graph is the standard method for interacting with OneNote notebooks, sections, and pages programmatically. By calling the specific page ID, you can receive the page's underlying HTML/XML markup.

1
Get the Page ID

Query the Microsoft Graph API for notebooks and sections to locate the specific unique page ID you want to retrieve.

2
Request Page Content

Make an HTTP GET request to the endpoint: `https://graph.microsoft.com/v1.0/me/onenote/pages/{id}/content`.

3
Include Content Headers

To get the XML or HTML structure accurately, ensure your request accepts `includeIDs=true` if you need to reference specific element IDs within the page.

4
Parse the HTML/XML

Once the API returns the response, use your preferred programming language's XML or HTML parser to locate specific elements like <table>, <tr>, and <td>.

Retrieve OneNote Page Content via Microsoft Graph API
Official Documentation: For comprehensive setup guides and endpoint details, refer to the Microsoft Graph OneNote integration documentation at https://learn.microsoft.com/en-us/graph/integrate-with-onenote.
Free Microsoft Office alternative

Try WPS Office for Your Everyday Documentation Needs

While Microsoft Graph APIs are required for custom OneNote integrations, if you are looking for a free, lightweight, and versatile suite for your daily document, spreadsheet, and presentation tasks, WPS Office is an excellent choice. It offers a familiar user interface and high compatibility with standard Office formats, ensuring seamless migration.

  1. 1. Download WPS Office: Visit the official WPS website and click the free download button for your operating system.
  2. 2. Install the Suite: Run the downloaded installer and follow the simple on-screen instructions to complete the setup.
  3. 3. Open and Edit Documents: Launch WPS Office to immediately open, create, and edit your existing Word, Excel, and PowerPoint files without formatting issues.
Fully compatible with Microsoft Word, Excel, and PowerPoint formatsLightweight application that runs smoothly on most devicesIncludes a powerful built-in PDF reader and editorFree to download and use for essential tasksFamiliar ribbon interface for seamless migration
microsoft office alternative - wps office

Frequently Asked Questions

What permissions do I need to read OneNote pages using Microsoft Graph?

You must grant your application the Notes.Read or Notes.ReadWrite permission in Microsoft Entra ID (Azure AD) and ensure the user or tenant admin consents to these scopes.

Can I extract only tables from the OneNote page XML directly through the API?

No, the Microsoft Graph API returns the entire page content as an HTML-like XML structure. You will need to fetch the full page content and then use a parser like BeautifulSoup (Python) or HtmlAgilityPack (C#) in your code to extract specific <table> tags.

Why is my Graph API request returning a 404 error for a OneNote page?

A 404 Not Found error usually means the page ID is incorrect, the page has been moved or deleted, or the authenticated user does not have access to the notebook containing the page.