Change layout of aspx page using site script

New Contributor

We want to enable our teams, to have a choice of which predefined page layout they can choose.

Is there a way, to change the site layout (arrange webparts on the aspx page) using SharePoint site scripting? If not, what do you think could be an alternative operation?


2 Replies

@Br_Joe  to change Webparts you don't need a script. First question: What SharePoint Version is it you are in? Classic SharePoint Site or Modern SharePoint Site? And you should avoid site scripts which where inserted once in classic SharePoint 2013 Sites, and there was a Script Editor Webpart then. Those where the days... :) 

If your Admin still alows you to take those old and outdated Webparts, you should be aware that in modern Sites you don´t have to script webparts anymore. The new code behind your aspx Web Pages is javascript, not xml. And we are still in some areas working the old pages but we should not engage again with scripts. To change webparts you just should edit a page and in this edit mode you can arrange webparts, add webparts and change their behaviour with the pencil icon. If you need some special user-defined manipulation, you can use javascript schemas and there are tons of javascript examples on it, on For instance the conditional formatting and other developping stuff on SharePoint Development documentation | Microsoft Docs

I hope that helps and give a LIKE if so.


If not, just pls. give more information of what you are trying to realize with your  pages or / and webparts. I am sure, there is already a webpart in modern SharePoint that will satisfy your needs within your pages (modern ones)...

have a good day, 




@Eva Vogel thanks for your detailed reply.

We are working with SharePoint online and the Modern Sites.

We are generating new SharePoint Sites from Power Automate for our sales teams. The different teams have different requirements, how a starting page for a customer should look like (but only in the layout of the webparts or apps). We want to give a choice which starting page they can use for their team (in Power Automate) and set the layout (arrangement of webparts) automatically. Our first thought was to use Site Scripting but as far as I read this is not possible with Site scritpting.  As this feature is very important for our sales teams we additionally are looking for alternative methods. We just want to avoid the manually arrangement of webparts  respectively don't want our sales teams to do so. So there is no background programming, it is just the automated arrangement of webparts.