0

I'm trying to post notebooks using the Graph API call POST /groups/{id}/onenote/notebooks. Before, these notebooks would appear in the OneNote Online portal as expected.

Unfortunately nowadays, they appear instead inside the Notebooks folder of the Documents tab of the SharePoint portal. Any reason for the change? Is there anything we can do to have the previous behaviour?

Thanks! meatpie

user2736738
  • 30,591
  • 5
  • 42
  • 56
meatpie
  • 11
  • 3

1 Answers1

0

Can you access the siteCollectionId and siteId via the https://www.onenote.com/api/v1.0/myorganization/siteCollections/FromUrl(url='https://xxx')
And then POST with .../api/v1.0/myorganization/sitecollections/{id}/sites/{id}/notes/sections/{id}/pages
?

codeye
  • 607
  • 3
  • 10
  • Thanks for responding. From my question, the notebook is associated with an Office 365 Group. Please clarify what the following refer to: https://xxx, sitecollections id, sites id. Thanks! – meatpie Mar 12 '18 at 15:06
  • xxx points to the folder where the notebooks are being stored. For me this is 'mysite.sharepoint.com/current/Shared Documents/Notebooks/' – codeye Mar 12 '18 at 15:52
  • Sorry sitecollection + site ids point to the folder that you are aiming to create or move the notebooks to. – codeye Mar 13 '18 at 13:17
  • Thanks for the clarification. xxx = https://{tenant}.sharepoint.com/sites/{group name}/Shared%20Documents/Forms/AllItems.aspx?id=%2Fsites%2F{group name}%2FShared%20Documents%2FNotebooks – meatpie Mar 13 '18 at 18:35
  • For sitecollection + site, we remember it showing up outright on the left panel of the OneNote Online Portal immediately after posting. Currently, we see it there after accessing it from the Documents folder but not before. Is this really expected? Thanks. – meatpie Mar 13 '18 at 18:41
  • Hi meatpie, I'm not sure if the behaviour you are seeing is expected, maybe someone from the OneNote team can advise. I was just thinking if you can get the sitecollections id and the sites id from the old (preferred) location via its url then you can post via the onenote-api to that location as described above as an alternative to posting by groups id. I don't think the microsoftgraph-api supports posting by sitecollections+sites id at this time. Cheers Steve – codeye Mar 14 '18 at 15:24
  • Thanks Steve, you've been great! I noticed that the original notebook is in SiteAssets whereas the posted ones are under Shared Documents. The Graph API only asks for the group ID when posting so it doesn't seem possible to specify where exactly the notebook would be under when posted. At any rate, hopefully somebody from the OneNote team could advise us about this issue. Cheers! – meatpie Mar 15 '18 at 19:39
  • No problem. You are right the graph API doesn't support sitecollections (as far as I can see) but why not use the OneNote API instead? – codeye Mar 16 '18 at 16:46
  • The MS Graph API does support sites. Here's how to get started:1. https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/site_get 2. Using the id from the #1, you can call GET /sites/{id}/onenote/notebooks described at https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/onenote_list_notebooks – Manjusha Apr 26 '18 at 19:18