Power Automate solution: OneNote action errors involving invalid or inaccessible Notebook Keys and sections

When using OneNote (Business) in a Power Automate flow, you may be attempting actions such as Create section in a notebook, Get sections in notebook, or Create page in a section but getting errors when trying to select the relevant notebook and section.

And depending on what you’re using as the Notebook Key and/or Notebook section value(s) you may get any of the following specific errors:

  • Error; the requested notebook or section may have been deleted or is otherwise inaccessible.
  • Invalid notebook key
  • The specified resource ID does not exist.
  • The section id is invalid. If a custom value was entered, please try selecting from the supplied values.

I’ll show you how you may be able to solve this issue in this blog post by using a custom value for Notebook Key. To insert a custom value for Notebook Key, use the dropdown arrow in the Notebook Key field and select Enter custom value.

Enter custom value option for Notebook Key (click to enlarge)

Now you can type text freely. You’ll need to format your notebook key one of two ways, depending on whether it’s a personal (OneDrive for Business) notebook or a shared (SharePoint/Teams) notebook. Both solutions are below.

Solution #1: OneNote Notebook key API format for your own notebooks (stored in OneDrive for Business)

For OneDrive notebooks, such as the default one you get like Nate @ Contoso, format your notebook key as seen below, replacing highlighted parts with your own notebook name, organization URL, and email address (with underscores instead of the usual symbols).

Nate @ Contoso|$|https://contoso-my.sharepoint.com/personal/nchamberlain_contoso_com/Documents/Nate @ Contoso

Still not working? Your organization may have a .com added (even if you don’t see it in your notebook name). Try adding .com to your notebook name in both locations (beginning and end):

Nate @ Contoso.com|$|https://contoso-my.sharepoint.com/personal/nchamberlain_contoso_com/Documents/Nate @ Contoso.com

Solution #2: OneNote Notebook key API format for shared notebooks (stored in SharePoint and used there or in Microsoft Teams)

For shared notebooks, such as the default one you get with every Microsoft Teams team or SharePoint team site, format the notebook key as follows. Be sure to replace bold components of the key with your own notebook name, organization URL, and notebook location:

Notebook Name|$|https://COMPANY.sharepoint.com/sites/SITENAME/NOTEBOOK LOCATION/NOTEBOOK NAME

For example, all default notebooks are stored in a SharePoint site’s Site Assets folder so a complete Notebook key for a notebook like that may resemble the following (yes, you can leave the spaces in notebook names):

Mark 8 Project Team Notebook|$|https://contoso.sharepoint.com/sites/Mark8ProjectTeam/SiteAssets/Mark 8 Project Team Notebook

Or if it’s not the default notebook, and it was created in a document library a couple folders deep, it might resemble the following. Just replace Shared Documents with the name of the library, and replace the folder structure as appropriate:

Policies and Procedures|$|https://contoso.sharepoint.com/sites/Compliance/Shared Documents/Folder 1/Folder 2/Policies and Procedures 

As long as you enter the key correctly using either solution, your flow will connect to the notebook properly and, when relevant, the Notebook section dropdown will refresh and allow you to simply select the section you want rather than entering an API URL.

Notebook section dropdown functioning properly with a correct Notebook Key (click to enlarge)

Additional troubleshooting when sections are still not appearing

If you are certain you followed the instructions above correctly, made no typos, and you used the correct type of key format based on the notebook’s location (OneDrive or SharePoint), and you’re still seeing “Could not retrieve values…” for Notebook section, it might be a simple fix.

Just cut (Ctrl+X) and paste (Ctrl+V) the Notebook Key you entered into the field again and it may refresh and fix the second dropdown.

References

OneNote (Business) – Connectors | Microsoft Docs

3 Replies to “Power Automate solution: OneNote action errors involving invalid or inaccessible Notebook Keys and sections”

  1. I had figured out this for our SharePoint Notebooks already somewhere in the depths of the internet. But thanks for sharing here, you did the best job of explaining it by far. My issue now is that some of the keys work, and some of them don’t. I have no idea what the difference is between the ones that work and the ones that don’t. I’ve triple checked spelling and spaces etc. Seems to be no rhyme or reason why some work and some don’t.

    1. I was able to get this to work by using the link you get when you go into SharePoint, get the “Site Contents” from the setting gear in the top right of the particular site. Our OneNote Notebooks are in the “Site Assets” folder. If you click the three dots for the context dropdown and click the “Copy link” option. Pasting that link into the Notebook key seems to work. I’ve figured out a way to do this from an excel sheet into PowerBI, but there are hundreds of pages I would have to manually click through. In any case, it does work if you get that specific private link. Hope that helps anyone that was dealing with the same issue.

  2. You’re a lifesaver.

    The only notebook of my dozens I wanted to incorporate into a power automate flow was the only one not populating in the list. I’ve spent well over an hour screwing around with various permissions and even contemplated relocating the notebook, but this works.

    Thanks!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.