【问题标题】:Get OneNote timestamps through the API通过 API 获取 OneNote 时间戳
【发布时间】:2020-01-12 23:09:50
【问题描述】:

有没有办法通过 OneNote API 或其他方式获取 OneNote 页面中内容的时间戳?我一直在使用 API 来获取页面的 html 内容和元数据,但是我还没有找到获取时间戳的方法。我想得到这些,所以我可以看到编辑历史。这些存在于 OneNote 中,因为它们在您突出显示文本并右键单击它时显示,如图所示:OneNote 时间戳。基本上有没有导出这些信息?理想情况下,这将使用 Python,但我并不挑剔。

谢谢。

【问题讨论】:

    标签: python rest onenote onenote-api


    【解决方案1】:

    假设您正在查找页面的编辑历史记录,您最好的选择似乎是在 Microsoft 对 GET /me/onenote/pages/{id} 的响应中使用“lastModifiedDateTime”字段。

    这是一个示例响应:

    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"
    }
    

    您可以在此链接的 OneNote REST API 文档中找到完整的详细信息:https://docs.microsoft.com/en-us/graph/api/page-get?view=graph-rest-1.0

    OneNote 笔记本和分区也有一个“lastModifiedDateTime”。

    您可以使用 Python 解析“lastModifiedDateTime”字段的响应。有关使用 Python 解析 API 响应的指南,请参阅以下两页。

    Selecting fields from JSON output

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

    祝你项目的其余部分好运!

    【讨论】:

      猜你喜欢
      • 2020-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-25
      • 2021-03-09
      • 2021-03-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多