Blog

Update Page Layout by using JavaScript (JSOM) in Office 365

 

image

Hi,

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.

I’d like to share the JSOM (JavaScript) code having in mind these assumptions:

– 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.

 

 

Hope that helps!

@jquintozamora

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

Post Navigation