Adding Script Editor web part to SharePoint classic page using PowerShell

 Hi friends,

When we are migrating the SharePoint on-prem to SharePoint online, we need to tell the users about the site is migrated and there are multiple ways of doing it. One of them is to add the redirection script on the page so that the user will get redirected by itself to the newly migrated site.

Adding Script Editor webpart to SharePoint classis page using powershell


In this blog, I will be showing how to add the script editor web part using the PowerShell and add the script as well.

Problem Statement

I have a SharePoint list where all the old sites and new sites are mapped. Need to read all the items and add the script editor web part along with the script for the redirection of the page to the new site URL.

Script added - It highlights the page and redirects the user to the new site after 10 seconds.

Note: If there is a need to change in the script, do change in the $WebPartXml variable.



Hope this script will save a lot of time and will help you.

Happy Coding..!!

Comments

Popular posts from this blog

Sorting in Typescript (Simple Arrays & Array of Objects)

SharePoint Framework (SPFx) Tab Control (react)

SPFx Chat Bot - using SharePoint Framework Extension