Azure function Site Design Site Script CSOM code for Site Creaion

%3CLINGO-SUB%20id%3D%22lingo-sub-301738%22%20slang%3D%22en-US%22%3EAzure%20function%20Site%20Design%20Site%20Script%20CSOM%20code%20for%20Site%20Creaion%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-301738%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20latest%20approach%20to%20modern%20team%20site%20is%20using%20site%20script%20and%20site%20design.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20we%20have%20a%20requirement%20where%20much%20of%20the%20execution%20happens%20as%20part%20of%20a%20web%20form.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20was%20wondering%20if%20we%20could%20put%20the%20necessary%20site%20creation%20information%20in%20a%20ShaePoint%20Listand%20have%20a%20flow%20run%20and%20create%20a%20site.%20Please%20correct%20me%20if%20wrong%2C%20i%20think%20the%20site%20script%20site%20design%20strategy%20will%20call%20the%20flow%20not%20the%20other%20way%20round.%20Is%20there%20a%20way%20to%20call%20Site%20design%20from%20a%20csom%20code.%20If%20not%20%2C%20i%20think%20i%20have%20to%20use%20Azure%20function%20with%20Powershell%20to%20create%20the%20site.%20Does%20all%20the%20PowerShell%20commands%20supported%20in%20Azure%20function%20(e.g.%2Cs%20applying%20a%20theme%20etc)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-301738%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAPIs%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExtensibility%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-302304%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20function%20Site%20Design%20Site%20Script%20CSOM%20code%20for%20Site%20Creaion%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-302304%22%20slang%3D%22en-US%22%3EYes%20you%20can%2C%20here%E2%80%99s%20some%20details%20on%20my%20blog%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22http%3A%2F%2Fwww.mcd79.com%2F2018%2F07%2F21%2Fexploring-creating-sharepoint-teamsites-using-sitedesign-and-the-rest-api.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fwww.mcd79.com%2F2018%2F07%2F21%2Fexploring-creating-sharepoint-teamsites-using-sitedesign-and-the-rest-api.html%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20key%20is%20posting%20this%20JSON%20with%20the%20implicit%20formula%20value%20the%20same%20for%20every%20tenancy.%3CBR%20%2F%3E%3CBR%20%2F%3E%7B%20%22displayName%22%3A%22%40%7BtriggerBody()%3F%5B'Title'%5D%7D%22%2C%20%22alias%22%3A%22Project-%40%7BtriggerBody()%3F%5B'ID'%5D%7D%22%2C%20%22isPublic%22%3Afalse%2C%20%22optionalParams%22%3A%7B%20%22Description%22%3A%22%22%2C%20%22CreationOptions%22%3A%5B%22implicit_formula_292aa8a00786498a87a5ca52d9f4214a_03dac6d2-3e91-4f43-9163-953ce1bf7616%7D%22%5D%20%7D%20%7D%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-301988%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20function%20Site%20Design%20Site%20Script%20CSOM%20code%20for%20Site%20Creaion%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-301988%22%20slang%3D%22en-US%22%3E%3CP%3Eis%20there%20an%20example%20to%26nbsp%3B%3CSPAN%3ESend%20HTTP%20Request%20action%20to%20apply%26nbsp%3B%20site%20script%20.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Edoes%20the%20Azure%20function%20supports%20all%20the%20cmd%20lets%20including%20the%20Applying%20the%20a%20site.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-301774%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20function%20Site%20Design%20Site%20Script%20CSOM%20code%20for%20Site%20Creaion%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-301774%22%20slang%3D%22en-US%22%3ESite%20Sritps%20and%20Site%20Designs%20are%20a%20mechanism%20to%20extend%20new%20sites%20or%20existing%20ones%2C%20but%20not%20to%20create%20a%20new%20site....if%20you%20need%20to%20automate%20site%20creation%2C%20you%20can%20follow%20approaches%20such%20as%3A%3CBR%20%2F%3E1)%20Use%20directly%20flow%20(using%20the%20SharePoint%20Send%20HTTP%20Request%20action)%20you%20can%20create%20sites%20and%20then%20apply%20a%20site%20script%20to%20then%3CBR%20%2F%3E2)%20You%20can%20create%20a%20site%20by%20means%20of%20an%20Azure%20Function%20tha%20can%20be%20coded%20in%20PowerShell%20o%20C%23.%20In%20both%20cases%20you%20are%20using%20SPO%20APIs%20%2B%20SPO%20cmdlets%20(only%20for%20the%20PS%20approach).%20This%20Azure%20Function%20could%20be%20called%20from%20a%20Flow%3C%2FLINGO-BODY%3E
Highlighted
Regular 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
Highlighted
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
Highlighted

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.

 

Highlighted
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}"] } }