Easy and effective way to setup SharePoint Migration Banner (2)
Please ensure to read part-1 of this blog here.
Below code-chunk adds banner under Page Title along with other dependencies is given below
Next we will create PowerShell which will follow the pseudo-code written in blog 1 and do following
- Add banner on all add sub-sites including root
- Finally, lock site-collection
The PowerShell for same is:
Please note that you can use $AddBanner flag to either add or remove banner. If you set it to $TRUE, it adds banner and locks site-collection. If $FALSE, it unlocks site-collection, and then removes banner from all sub-sites
In case you need steps to make above code work:
- Save first code-block as a JavaScript file, say ‘banner.js’
- Save second code-block as a PowerShell file, say banner.ps1
- Ensure to create migration list as mentioned in blog 1 with required columns — make a note of internal column names used in the PowerShell
- Run the PowerShell and you shall see the magic
Note: Part of approach and code may be inspired by the Internet. If there is a specific person whose work has influenced mine, the credit is of that person.