I have a sharepoint online site. There, I have created a Project Sub-site. I need to clone that sub-site structure for several others.

I was thinking if I can create a list, and when I add an entry into that list, the subsite is created with the list entry details. When I delete the entry, the sub-site is deleted as well along with its contents.

Is that possible?


Everything is possible!

Most likely solution would be SharePoint 2013 style workflow on that list that calls the SharePoint REST API to create the sites.


You can do this with either event receivers or the aforementioned SharePoint 2013 workflow calling the REST API.

With event receivers you'll need to host the code that actually executes your commands outside of SharePoint Online. The easiest way to do this is with an Azure function. From there you can either use Powershell or the REST API to create and delete subsites. However, you can only use Powershell if you have global admin rights.

Using a SP2013 workflow to call the REST endpoint will be more self-contained and probably the easier choice if you're not trying to do a lot of custom site provisioning steps.

Either way, the REST endpoint you're looking is: http:///_api/web/webs/add

Microsoft's documentation is below:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy