关于MS-Graph OneNote API是否支持设置分区内页面层级与顺序属性的问询
Great question! Let's break down what's currently possible and share workarounds you can use right now:
Current API Limitation
As you've observed, neither the v1.0 nor Beta versions of the MS Graph OneNote API support directly writing to the level or order properties of pages within a section. The Beta endpoint only exposes these properties for read operations (via GET /me/onenote/sections/{section-id}/pages), but there’s no PATCH endpoint or dedicated method to modify them directly.
Workarounds to Achieve Similar Results
While direct writes aren’t available, you can mimic the desired behavior using existing API capabilities:
Adjusting Page Level (Hierarchy)
OneNote natively determines a page’s level based on indentation in the page title. You can leverage this by updating the page’s title with tab characters (\t) to set the desired hierarchy:
- For a level 1 page (indented once), prepend one
\tto the title - For level 2, prepend two
\tcharacters, and so on
Use the PATCH endpoint to update the title:
PATCH /me/onenote/pages/{page-id} Content-Type: application/json { "title": "\tMy Indented Page Title" }
After updating, OneNote will automatically set the corresponding level property, which you can verify with a subsequent GET request.
Adjusting Page Order
There’s no direct way to set a page’s order value via API, but you can indirectly control page sequence by moving pages strategically:
- Use the
POST /me/onenote/sections/{target-section-id}/pages/moveendpoint to transfer pages between sections - OneNote appends moved pages to the end of the target section. So to reorder pages, move them to a temporary section first, then move them back to the original section in your desired sequence. For example:
- If you want pages in the order
Page B → Page A → Page C, move Page A to a temp section first, then move Page B to the target section, then Page A back, then Page C (if needed)
- If you want pages in the order
This method is a bit manual, but it works reliably for small sets of pages.
Future Updates
Many developers have requested direct write support for level and order properties in Microsoft’s feedback forums. Keep an eye on the Beta API’s release notes—Microsoft often rolls out new features there first before promoting them to v1.0.
内容的提问来源于stack exchange,提问作者Michael Lynch

