SharePoint Page Transformation Using PowerShell

What does Page Transformation do?

 
Page Transformation converts the page into a modern experience by creating modern pages in the library. But not all the functionalities are migrated as is; we need to re-write those functionalities with SPFx framework.
 
How to use it?
  1. PnP PowerShell https://akka.ms/sppnp-powershell
  2. .NET development https://nuget.org
  3. UI Integration https://aka.ms/sppnp-pagetransformationui

Sharepoint Page Transformation Using PowerShell

 
In this article, we are going to see the process of transforming the classic wiki web part pages into modern pages in a different scenario by using PnP PowerShell.
 
ConvertTo-PnPClientSidePage
 
Converts a classic page (wiki or web part page) into a Client-Side Page
 
We have a simple classic page. Now, we will see how to convert this page into Modern page using PnP command. 
 
Page Transformation
 
Execute the following PnP command. This will help in converting to Modern Page.
 
ConvertTo-PnPClientSidePage -Identity "somepage.aspx" -Overwrite
 
Page Transformation
 
Converted site is in the Modern experience.
 
Page Transformation
 

Page Swapping

 
We have created a simple classic NewsWikipage, now we are going to convert it into a modern page by retaining the old page as it is in Sitepage library.
 
Page Transformation
 
Step 1
 
We are going to connect to Sharepoint online site by using the pnp command.
 
Page Transformation
 
Step 2
 
TakeSourcePageName takes its name from the previous classic page. Classic page gets renamed to previous-<Page>.aspx
 
Powershell - ConvertTo-PnPClientSidePage -Identity "somepage.aspx" –Overwrite -TakeSourcePageName
 
Page Transformation
 
Now the wiki page is looking like this
 
Page Transformation
 
New page created will be available in the SitePage library.
 
Page Transformation
 

Page Logging

 
We can get the details of logging during the Page Transformation that will help to understand what happened during the transformation of the page.
 
Now, we are going to see how to log details in Sharepoint by using PnP command
 
PowerShell - ConvertTo-PnPClientSidePage -Identity "somepage.aspx" –Overwrite –LogType Sharepoint
 
Page Transformation
 
Once the command is executed successfully, open Site Page Library. A new folder will be created with the name “Transformation-Reports”. A Page-Transformation-Report will be created where it includes the Modernization summary report like Source Page, TargetUrl….
 
Page Transformation
 

Metadata and permission

 
We can also Convert a wiki page to a client-side page, including the copying of the page metadata.
 
Real world pages often have custom metadata defined, sometimes they also have custom permission defined. Now we will see how to transform these pages.
 
Page Transformation
 
We can also skip the Item level permission if any.
 
Page Transformation
 
Hope you learned something in this article. Stay tuned for the next article where we are going to learn to transform the Publishing pages using PnP PowerShell.