0

Using Microsoft Graph, body, title, etc. seem easy to update, but I can't seem to figure out the right syntax for created date. I'm making a copy of a current page (only way to get lined pages, it seems) and want the created date to reflect when the target created date should be.

Here is the content in OneNote:

<head>
        <title>New Title</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="created" content="2019-07-22T09:00:00.0000000" />
    </head>

I've tried

data=json.dumps([
                {
                    "target": "meta: #created",
                    "action": "replace",
                    "content": "2019-07-23T09:00:00.0000000"
                }
            ])

and

data=json.dumps([
                {
                    "target": "created",
                    "action": "replace",
                    "content": "2019-07-23T09:00:00.0000000"
                }
            ])

but get

{
  "error": {
    "code": "20134",
    "message": "The Patch request message is invalid: The selected target meta: #created is not a valid updateable element.",
    "innerError": {
      "request-id": "156f1db9-a331-4ee4-96f8-15d90d393f63",
      "date": "2019-06-12T12:25:54"
    }
  }
}

What would be the right syntax?

coopermj
  • 531
  • 4
  • 16

2 Answers2

0

Patch the page's CreatedDate is not currently supported. How are you copying the page? If you use the Graph OneNote API https://learn.microsoft.com/en-us/graph/api/page-copytosection?view=graph-rest-1.0&tabs=cs won't you get the correct CreatedDate on the copied page?

Manjusha
  • 538
  • 2
  • 4
  • I have a script that creates a Note for each event on my Google Calendar. I'd like to set the CreatedDate to the time/date of the meeting. I'm using copy instead of create b/c it also appears you cannot set lined page view using the API. – coopermj Jun 19 '19 at 14:29
0

You can set the Page title to the meeting time using Patch-pages-content with target=title

Manjusha
  • 538
  • 2
  • 4