Azure function Site Design Site Script CSOM code for Site Creaion

Iron Contributor

The latest approach to modern team site is using site script and site design.

 

However, we have a requirement where much of the execution happens as part of a web form.

 

I was wondering if we could put the necessary site creation information in a ShaePoint Listand have a flow run and create a site. Please correct me if wrong, i think the site script site design strategy will call the flow not the other way round. Is there a way to call Site design from a csom code. If not , i think i have to use Azure function with Powershell to create the site. Does all the PowerShell commands supported in Azure function (e.g.,s applying a theme etc)

3 Replies
Site Sritps and Site Designs are a mechanism to extend new sites or existing ones, but not to create a new site....if you need to automate site creation, you can follow approaches such as:
1) Use directly flow (using the SharePoint Send HTTP Request action) you can create sites and then apply a site script to then
2) You can create a site by means of an Azure Function tha can be coded in PowerShell o C#. In both cases you are using SPO APIs + SPO cmdlets (only for the PS approach). This Azure Function could be called from a Flow

is there an example to Send HTTP Request action to apply  site script .

 

does the Azure function supports all the cmd lets including the Applying the a site.

 

Yes you can, here’s some details on my blog:

http://www.mcd79.com/2018/07/21/exploring-creating-sharepoint-teamsites-using-sitedesign-and-the-res...

The key is posting this JSON with the implicit formula value the same for every tenancy.

{ "displayName":"@{triggerBody()?['Title']}", "alias":"Project-@{triggerBody()?['ID']}", "isPublic":false, "optionalParams":{ "Description":"", "CreationOptions":["implicit_formula_292aa8a00786498a87a5ca52d9f4214a_03dac6d2-3e91-4f43-9163-953ce1bf7616}"] } }