I’m going to show how to update or change the page layout for a given SharePoint page. That sounds quite straightforward, but we have to mind some important bits:
- Check in, check out status of the current page or item we are changing.
- CAML query using Page Layout as a FieldRef filter
- Use SP.FieldUrlValue to update the Page Layout property.
- we already have both layouts in the _catalogs/masterpage library
- we are executing the JS code in the subsite in which we want to update the pages
- we are iterating thru all the pages currently using pageLayoutToChange and set to them the new layout.
All articles in this blog are licensed under CC BY-SA 4.0 unless stating additionally.