SharePoint 2013, SharePoint Online

Bulk Delete SPO Sub-Sites

I was recently looking for a way to bulk delete sub-sites as I was doing some testing with deploying subsites and realized the SharePoint Online PowerShell management pack doesn’t come with any cmdlet to get subsites and do an action with the items, so I went to work to build a simple tool using the SharePoint client object model that would allow me to delete all sub-sites under a site collection but not removing the root site.

Alas after a little time coding and testing we have the “SharePoint Online: Bulk Delete Sub-Sites”


In the URL field please enter the URL of the Site Collection you would like to delete all the sub-sites from (note: this will not remove the root Site collection only all the sub-sites underneath the root).

Enter in the Username/Password of an account with Site Collection Administrator Privileges, without this level of permission the tool will fail to work so please verify that you have Site Collection Administrator rights before running this tool

Click ‘Delete‘ and it will start deleting all your subsites, the tool is pretty quick to run through each subsites and delete I ran a test of 100 subsites and took under 30 seconds so the tool is quite quick and powerful.


Feel free to ask questions or make suggestions as I’m always looking to add more functionality into my developments.


You can download the tool from here



2 thoughts on “Bulk Delete SPO Sub-Sites

  1. Hello James-
    Thank you for making this tool, i have tried it once today and it was fine and deleted the subsites, the second time i tried it i received an HTTP 401 (unauthorized access) with the credentials 🙂
    is there any way you can post the source code in codeplex so we can collaborate in it and add features?

    1. I put this together quite sometime ago, I’ll have to dig up the source code in the mean time what sort of feature’s would you like to see added?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s