0

Is there a way to get the timestamps for content in a OneNote page through the OneNote API, or another way? I have been using the API to get the html content and metadata of my pages, however I have not found a way to get the timestamps. I want to get these so I can see an edit history. These exist in OneNote as they show up when you highlight text and right click on it, as shown: OneNote Timestamp. Basically is there anyway to export this information? Ideally this would be in Python, but I'm not picky.

Thanks.

dwr39
  • 31
  • 1

1 Answers1

0

Assuming you are looking for the edit history of a page, it seems like your best bet is to use the "lastModifiedDateTime" field in Microsoft's responses to GET /me/onenote/pages/{id}.

Here is a sample response:

HTTP/1.1 200 OK
Content-type: application/json
Content-length: 312

{
  "title": "title-value",
  "createdByAppId": "createdByAppId-value",
  "links": {
    "oneNoteClientUrl": {
      "href": "href-value"
    },
    "oneNoteWebUrl": {
      "href": "href-value"
    }
  },
  "contentUrl": "contentUrl-value",
  "content": "content-value",
  "lastModifiedDateTime": "2016-10-19T10:37:00Z"
}

You can find the full details in their OneNote REST API documentation at this link: https://docs.microsoft.com/en-us/graph/api/page-get?view=graph-rest-1.0.

OneNote notebooks and sections also have a "lastModifiedDateTime".

You can use Python to parse the response for the "lastModifiedDateTime" field. See the two pages below for guidance on parsing API responses with Python.

Selecting fields from JSON output

What's the best way to parse a JSON response from the requests library?

Best of luck with the rest of your project!

Chana
  • 317
  • 3
  • 9