Migrating OneNote pages to SharePoint as documents can be a tedious task when done manually. In this blog, I will explain a step-by-step process to automate the migration using Power Automate.
Note: Images inside OneNote pages cannot be migrated using this method. A different approach and some manual works are required for that.
1. Trigger: Manual Trigger
I have used a manual trigger for this flow, but you can modify it as per your needs. Additionally, I have initialized two variables to store the notebook key and section key.
2. Get OneNote Notebooks
I used the "Get recent notebooks" action to fetch the available notebooks and added a condition to select only one notebook, storing its key in a variable. If needed, you can loop through all the notebooks instead.
3. Get Sections of a Notebook
The "Get section in notebook" action retrieves all sections within a notebook when the notebook key is passed dynamically. After this, I added an "Apply to each" action to store the section key in a variable.
Next, I passed the notebook key and section key into the "Get pages for a specific section" action, which retrieves all pages of the section.
4. Retrieve Page Content
In the "Get page content" action, I dynamically passed the stored variables (notebook key and section key) along with the page ID retrieved from the previous action. This retrieves the page content in raw HTML format.
5. Convert HTML Page Content to PDF
Since I couldn't convert the HTML file content directly to a PDF, I leveraged OneDrive actions to accomplish this.
Alternative Approach: If needed, we can directly pass the HTML content into the SharePoint Create File action and store the .doc file in SharePoint. This file can only be used for viewing, as it follows an older format.
Editing Note: If you want to edit the document, SharePoint will automatically create a new file in the same location with a .docx extension, allowing you to edit it as a modern Word document.
Automating the migration of OneNote pages to SharePoint using Power Automate simplifies the process and saves time. By leveraging Power Automate’s OneNote and SharePoint actions, we can efficiently convert OneNote pages into PDFs or .doc files while ensuring proper storage in SharePoint. This method reduces manual work and provides flexibility in handling document formats.
Need help implementing this for your organization? Our SharePoint consultants and Power Automate experts can guide your automation journey.