Search code examples
htmlonenoteonenote-api

Missing data-id or id on default tags(checkboxes)


I was trying to update todo tags with patch but the id or data-id is missing from pages created by onenote with default todo tags.
How can I Target the element with patch?

This is an example page where the data-tag="to-do" has no id to target.

<html lang="en-US">
<head>
    <title>Test todo&#39;s</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="created" content="2016-07-01T11:26:00.0000000" />
</head>
<body data-absolute-enabled="true" style="font-family:Calibri;font-size:11pt">
    <div style="position:absolute;left:48px;top:115px;width:576px">
        <p style="margin-top:0pt;margin-bottom:0pt">Hello,</p>
        <br />
        <p style="margin-top:0pt;margin-bottom:0pt">These are some default todos from onenote desktop.</p>
        <br />
        <p data-tag="to-do" style="margin-top:0pt;margin-bottom:0pt">Default todo tag;</p>
        <br />
        <p style="margin-top:0pt;margin-bottom:0pt">Can we target a default todo tag?</p>
        <br />
        <br />
        <p style="margin-top:0pt;margin-bottom:0pt">Gijs</p>
    </div>
</body>


Solution

  • Just add includeIDs=true parameter to the url while getting page content.
    Here is an example:
    https://www.onenote.com/api/v1.0/me/notes/pages/[PageID]/content?includeIDs=true