Forum Discussion
Add new SPWeb with Sitescript?
- Mar 07, 2019
Be aware that Site Designs and Site Scripts do not work well with sub sites. Sub sites are kind of a "faux pas" in the modern world. If you try to create a subsite, there are many scenarios where the site script will not work (for example, site content types and columns are known to not deploy on subsites)
You can use PnP PowerShell to create a new web (subsite) and delete the libraries and nav nodes you don't need
https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/new-pnpweb?view=sharepoint-ps
https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/remove-pnplist?view=sharepoint-ps
https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/remove-pnpnavigationnode?view=sharepoint-ps
If you need to do this with a Site Script, you can use the Trigger Flow verb, which can call an Azure Automation PowerShell runbook with PnP PowerShell cmdlets installed which can then use the above cmdlets to delete the unnecessary lists and navigation nodes:
https://spmaestro.com/sharepoint-pnp-provisioning-using-flow-and-azure-automation/