In this tutorial, we will learn how to delete SharePoint site. Here we will learn the steps to delete both the Modern and Classic SharePoint site. There are many ways to delete a SharePoint site, which we will see step by step. By the end of this tutorial, you will get to know, how to delete a sharepoint site.
Also, we will see how to restore a deleted SharePoint site.
We can easily delete a SharePoint site using PowerShell, I will show you how to do it.
Delete a SharePoint Site (Modern Site)
Follow all the steps to delete the SharePoint site in the SharePoint modern experience.
- Firstly, open your SharePoint Online site, after that click the setting button/gear icon. Then click on the Site Information link.
- Bottom of the Site Information there is an option for Delete Site, check the fig below:
- When you click on the delete site link, then one popup box will open. Here sort of information is written that all the resources (sites, files, calendar, etc) will be deleted. If anyone wants backup then go for backup and delete the site. If the information is important then better to keep a backup before deleting the site.
Now, the SharePoint site will get deleted and it will be available under Deleted sites in the SharePoint Online admin center. You can also restore the SharePoint site from there, I have explained below.
Delete a SharePoint site from SharePoint Online Admin Center (Modern site)
- Another way to delete your site, go to the SharePoint admin center then click on Sites -> Active sites.
- Here on the Active sites page, you will find all your active SharePoint sites.
- Select the SharePoint site you want to delete and then click on the Delete button on the command bar.
- Once you delete your site it will move to the Deleted Sites.
Delete a SharePoint Site (Classic Site)
- Open your SharePoint site (Classic site), click on the setting icon/gear icon and then click on Site settings.
- On the Site Setting page, go to the Site Actions, and click on Delete this site link.
- After clicking on the delete this site, the warning page will open. Inside the warning page, there is sort of information is written (i.e whole site will be deleted with all the resources). If you want to delete the SharePoint site then click on the Delete button present in the bottom corner of your site.
- After that, it will go to the deleted sites in the admin center. Here you can restore your deleted SharePoint site.
Delete a SharePoint site from the admin center (Classic site)
- Another way to delete your site, go to the SharePoint admin center then click on Sites -> Active sites.
- Here in Active Sites, you will find all your active SharePoint Online sites.
- Select the SharePoint site you want to delete then, there is an option for the Delete button on the command bar.
- Once you delete your site it will move to the Deleted Sites.
Note: Once your site has been deleted, it will be available in the SharePoint admin center. In the admin center, click on Sites -> Deleted Sites. Click on the deleted sites, here you will find your site.
Restore Deleted SharePoint Site
If you want to restore the SharePoint site, then go to the SharePoint Online admin center.
Then click on Sites -> Deleted sites.
Here you will find all deleted sites and select the SharePoint site which site you want to restore. Then click on the Restore button from the command bat and the site will get restored.
How to delete a SharePoint site using PowerShell
Now, let us see, how to delete a SharePoint site using PowerShell. We will also see, how to restore the SharePoint site using PowerShell and by using the browser.
In the same way, we can delete sites or subsites using browser and PowerShell in SharePoint 2013/2016 or SharePoint Online.
We will also see how to delete a SharePoint Online site collection using PowerShell.
Delete SharePoint site using browser
Follow the below steps to delete site using a browser in SharePoint Online as well as SharePoint on-premises.
Open your SharePoint 2013 online site, then Click on settings -> Site Settings. Then from Site Actions click on “Delete this site”. This will show you a warning message, there click on the Delete button as shown in the fig below:
But here one problem will come if there will be subsites within that site. In that case, you might get the below error:
Sorry, something went wrong
There was a problem deleting Website “/MyTeamSubSite”. Sites that have subsites or certain apps can’t be deleted. Please try again after deleting all subsites and removing the apps.
To solve the issue we have to delete the child subsite first and then we can be able to delete the parent site.
Delete SharePoint Site using PowerShell (on-premises)
Below is the PowerShell command to delete a site collection which includes all sites and subsites under it in SharePoint On-premises versions like SharePoint 2013/2016.
Add-PSSnapin “Microsoft.SharePoint.PowerShell”
Remove-SPSite -Identity “http://win-pfcp2dgt8di/sites/EnjoySharePoint/” -GradualDelete -Confirm:$False
Below is the PowerShell command to delete a particular subsite in SharePoint 2013/2016.
Add-PSSnapin “Microsoft.SharePoint.PowerShell”
$SiteURL = “http://win-pfcp2dgt8di/sites/EnjoySharePoint/MyTestSubSite/MySubSubSite/”
$web = Get-SPWeb $SiteURL
$web.Delete()
Delete SharePoint Online Site using PowerShell
We can use the Remove-SPOSite cmdlet to delete a site collection in SharePoint online. This command will not delete the site collection permanently rather the site collection will be moved to Recycle Bin from where we can restore the site collection using Restore-SPODeletedSite cmdlet.
Below is the PowerShell cmdlet to delete site collection in SharePoint Online.
Import-Module Microsoft.Online.SharePoint.Powershell -Verbose
Remove-SPOSite -Identity “https://onlysharepoint2013.sharepoint.com/teams/MyDeleteSiteColTest”
After executing this command, if you will open the Recycle Bin in SharePoint 2013 online admin center you will be able to see the deleted sites there like below:
Restore Deleted Site Collection from Recycle Bin in SharePoint
If you want to restore the deleted site collection from the recycle bin then in the browser you can select the site and then click on Restore Deleted Items. It will restore the site collection. Otherwise, you can use the below PowerShell command.
Import-Module Microsoft.Online.SharePoint.Powershell -Verbose
Restore-SPODeletedSite -Identity https://onlysharepoint2013.sharepoint.com/teams/MyDeleteSiteColTest
Remove Site Permanently from Recycle Bin in SharePoint Online
We can use the Remove-SPODeletedSite cmdlet to permanently delete the site from recycle bin. After this, you will not be able to restore the site.
Import-Module Microsoft.Online.SharePoint.Powershell -Verbose
Remove-SPODeletedSite -Identity https://onlysharepoint2013.sharepoint.com/teams/MyDeleteSiteColTest
Delete SharePoint Online Site Collection using PowerShell
This SharePoint Online PowerShell tutorial explains, delete site collection SharePoint online PowerShell. We will also see how to restore the deleted site collection using PowerShell in SharePoint Online Office 365. We will also discuss how to delete SharePoint Online site collection permanently using PowerShell in SharePoint Online Office 365.
We can use Remove-SPOSite PowerShell cmdlets to move the site collection to the recycle bin in SharePoint Online Office 365. This command will not delete the site collection permanently instead it will just move to the recycle bin in SharePoint Online.
Just to let you know that you must be a SharePoint Online global administrator and a site collection administrator to run the below cmdlet.
Even if you are a SharePoint Online global administrator, it will not allow you to delete the site collection if you are not a site collection administrator.
PowerShell Command to delete SharePoint Online site collection
Below is the PowerShell command to delete the site collection in SharePoint Online Office 365.
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
Connect-SPOService -Url https://onlysharepoint2013-admin.sharepoint.com -credential [email protected]
Remove-SPOSite -Identity https://onlysharepoint2013.sharepoint.com/sites/MySite -Confirm:$false
Once you run the command, the site will be moved to the recycle bin in SharePoint Online. See the fig below:
Delete a SharePoint site Permanently using PowerShell
If you want to permanently delete the site from the recycle bin, you can run Remove-SPODeletedSite command like below:
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
Connect-SPOService -Url https://onlysharepoint2013-admin.sharepoint.com -credential [email protected]
Remove-SPODeletedSite -Identity https://onlysharepoint2013.sharepoint.com/sites/MySite -Confirm:$false
The above PowerShell cmdlets delete a SharePoint Online site collection permanently.
Remove-SPOSite Access denied You do not have permission to perform this action or access this resource
If you got this error, Remove-SPOSite Access denied You do not have permission to perform this action or access this resource, then check the below solution.
The problem was that the account I was using. The account should be a site collection administrator for the site which you are going to delete. After I add the user to the site collection administrator, I was able to delete the site collection.
Restore Deleted Site Collection using PowerShell in SharePoint Online Office 365
Similarly, if you want to restore the deleted site collection from the recycle bin in SharePoint Online Office 365, you can run the below PowerShell cmdlets.
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
Connect-SPOService -Url https://onlysharepoint2013-admin.sharepoint.com -credential [email protected]
Restore-SPODeletedSite -Identity https://onlysharepoint2013.sharepoint.com/sites/MySite
Once you run the above command, the site collection will be get restored from the recycle bin in SharePoint Online Office 365.
How to delete site collection in SharePoint Online from Browser
Now we will see, how to delete site collection in SharePoint 2013/Online. Remember you need to be a SharePoint site collection administrator to delete site collection.
When you will delete a site in SharePoint, the site will be moved to the recycle bin, the site can be restored from the site collection recycle bin by a site collection administrator.
Delete SharePoint Online Site Collection from browser
A SharePoint Online Site collection can be deleted from the SharePoint Online admin center. Open SharePoint Admin Center and then from the left side choose site collections and then select the particular site and then click on Delete button.
But to delete a subsite, you can open the site in the browser and then go to the Site Settings page. And there you can see “Delete this site” which is under Site Actions.
We can delete a site collection from the SharePoint 2013 central administration.
Delete SharePoint Site from browser
To delete a SharePoint 2010 site, Open the site in the browser and then click on Site Actions and then Site Settings.
Then it will open the settings page, from the Settings page click on Delete this site.
When you click on this link the Delete confirmation page will open which shows you the warning and will tell you what all will delete once you delete the site. Then click on Delete. This will delete your SharePoint site as well as its contents.
I hope this PowerShell SharePoint tutorial explains how to delete site collection in SharePoint Online using PowerShell?
How to permanently delete site collection using PowerShell in SharePoint Online Office 365? Also, how can we restore a deleted site collection from the recycle bin using PowerShell in SharePoint Online Office 365?
You may like the following SharePoint tutorials:
- 3 Different ways to Change Site Collection URL in SharePoint
- Bulk SharePoint Online Site Collection Creation using PowerShell
- Self-Service Site Collection in SharePoint 2013/2016
- Create Site Collection and Subsite in SharePoint Online using PowerShell
- SharePoint 2016 Fast Site Collection Creation using PowerShell
- Delete corrupted SharePoint site collection using PowerShell
- What is a SharePoint hub site?
In this tutorial, we leaned how to delete a SharePoint online site, as well as how to delete a SharePoint site from the SharePoint online admin center. I have explained for both classic site as well as for the modern SharePoint site.
Also, we saw how to delete the SharePoint site or subsite from the browser in SharePoint 2013/2016/Online. Also, we saw how to delete the site using PowerShell in SharePoint 2013/2016 or SharePoint Online.
And, how to remove site permanently from Recycle Bin in SharePoint Online? How to restore deleted site collection from Recycle Bin in SharePoint Online using PowerShell.
Bhawana Rathore is a Microsoft MVP (3 times in Office Apps & Services) and a passionate SharePoint Consultant, having around 10 years of IT experience in the industry, as well as in .Net technologies. She likes to share her technical expertise in EnjoySharePoint.com and SPGuides.com
Thank you very much.
This information is very useful to me.
Thank you for the great information shared by you. The tutorial was of great help. Thank you very much.