How to transform classic pages to modern pages in PowerShell?

How to transform classic pages to modern pages in PowerShell?

The ConvertTo-PnPClientSidePage cmdlet is the key cmdlet to modernize a given page. Below table lists the command line parameters that you can use to control the page transformation via this cmdlet. The page name (e.g. pageA.aspx) for wiki, web part and publishing pages or the blog title for classic blog pages.

How to convert a wiki page to SharePoint Online?

Converts wiki page to SharePoint online modern page with the “AddPageAcceptBanner”. The above command converts a wiki page named ‘somepage’ to a client-side page and adds the page accept banner web part on top of the page. This requires that the SPFx solution holding the web part has been installed to the tenant app catalog.

How to convert a SharePoint site to a modern page?

Using the below code we can convert the classic SharePoint site page to a modern page:

Can a page transformation engine be used in PowerShell?

The page transformation engine can also be used from PowerShell. This allows it to be integrated in a site modernization script that besides page transformation also does other things like installing solution, connecting the site to a Microsoft 365 group and applying tenant branding.

Can a classic SharePoint page be a modern page?

Classic SharePoint sites typically have classic pages being wiki pages, web part pages, blog pages or publishing pages and these pages cannot present themselves using a modern user interface. A classic site however can host modern pages which enable great end user experiences.

How to add webparts to classic pages using PNP PowerShell?

Click on the Classic Pages tab : 5) Copy the entire contents, including the webParts tags and store it locally as a .dwp or .webpart file in your local machine or file storage. 6) Now, we will deploy the webpart on a classic page using PnP PowerShell.

How to find out the custom template name?

Using this, you can find out the custom template name as well as its ID Thanks for contributing an answer to SharePoint Stack Exchange! Please be sure to answer the question. Provide details and share your research! But avoid … Asking for help, clarification, or responding to other answers.

When do you copy page metadata in PowerShell?

The default behavior is to not copy page metadata (so additional columns added to the site pages library). When -CopyPageMetadata is specified the values of the custom metadata fields of the page to transform are copied to the newly created page. As of the October 2019 release page metadata copy also works in cross site transformations.

How to disable URL rewriting in PowerShell?

During publishing page transformation URL’s are rewritten to be valid in the target site collection, but using the -SkipUrlRewriting you can disable the URL rewriting. See the URL mapping article to learn more.

How to create a log page in SharePoint?

Use -LogType to enabled logging: File will log to disk, SharePoint will create a log page in the SharePoint SitePages library, Console will output data to the console. If LogType is set to File then you can use -LogFolder to specify the folder where the log will be created. Use -LogVerbose to generate a verbose log.

Is the modern page feature enabled in SharePoint?

By default the modern site page capability is enabled on most sites but maybe it was turned off afterwards. If that’s the case the SharePoint Modernization scanner will tell you which sites have turned of the modern page feature. To remediate this use below sample PnP PowerShell script:

How to use PNP PowerShell for SharePoint Online?

To do this you need to use PnP PowerShell for SharePoint Online to connect to your on-premises portal like shown in below script: