Automating OneNote to SharePoint Migration Using Power Automate’s OneNote Actions

 

Automating OneNote to SharePoint Migration Using Power Automate’s OneNote Actions

automate-onenote-to-sharepoint-migration-power-automate

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.

Step-by-Step Automated Migration Flow

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.

Manual-trigger

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.

get-Onenote-notebooks
Save hours of manual work get expert automation support

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.

Get-sections-notebook

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.

Retrieve-page-content
Struggling with SharePoint integrations or automation? Our team of SharePoint consultants and PowerApps experts can guide you through every step.

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.

  • First, I created a file in the OneDrive root folder, passing the page title dynamically and adding a .doc extension. I also passed the HTML file content.
  • Next, I used the "Convert file" action in OneDrive, passing the file ID and selecting PDF as the output format (other available formats include GLB, HTML, and JPG).
  • After converting the file, I created a PDF file in SharePoint, passing the file name and content from the convert file action. This successfully created a PDF in the designated SharePoint folder.
  • Finally, I deleted the temporary OneDrive file to keep everything clean and organized.
Convert-HTMLpage-content-pdf

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.

Conclusion

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.

Comments

Popular posts from this blog

Latest Updates on SharePoint Online: Table Toolbar, API Access Changes, and eSignature Enhancements

Boosting Your Business with the Automation Center in Power Platform