How to Delete a SharePoint Site

New SharePoint sites are easily created in Microsoft 365, but sometimes a bit too easy. I often see a lot of unused SharePoint sites in SharePoint online. Users accidentally created two sites for the same project, or just wanted to test something out. So sometimes we will need to delete SharePoint sites to keep our environment cleaned up.

It’s important to check if SharePoint sites are not used anymore before we can delete them. And this can sometimes be a challenge because modern sites can look inactive, even though the Teams chat is actively used.

In this article, we are first going to take a look at how to delete a SharePoint site. And later on, we will take a look at how to find inactive sites.

What you need to know

Before we take a look at how to delete a SharePoint site, there are a few things you need to keep in mind. To delete a site you will need to be either a site owner or a SharePoint administrator. If it’s a communication site, then you will also need to have the site admin role.

These days we have the classic SharePoint sites (standalone sites) and modern sites. Modern sites are Microsoft 365 Groups that have a Teams channel, SharePoint site, OneNote, Planner, etc. Deleting the sites is for both practically the same, but keep in mind that with a modern site, also Teams, OneNote, Planner, etc is deleted.

Tip

You can configure alerts for when a SharePoint site or Team is deleted. I have seen enough cases where Site Owners deleted the Team and all the SharePoint data was lost as well.

SharePoint sites or Microsoft 365 Groups that are deleted are retained for short period. This allows you to restore all the content in case you accidentally deleted the wrong SharePoint site. The retention period is different for classic sites and modern sites:

  • Classic SharePoint site: 93 days
  • Modern SharePoint site: 30 days

At the end of the article, I will also explain how you can restore a SharePoint site or Microsoft 365 Group (Modern site).

Delete a SharePoint Sites

There are two locations where you can delete a SharePoint site, in the SharePoint Admin Center if you are a SharePoint administrator or in the site settings when you are Site Owner.

Deleting a Modern SharePoint Site

Most SharePoint sites these days are modern sites. When you are a site owner, you can delete the SharePoint site using the site settings:

  1. Open the SharePoint site
  2. Click on the gear icon (Settings)
  3. Choose Site Information
Open Site Settings in SharePoint
  1. Click on Delete Site. (If you don’t see that option, then double-check that you are a site owner)
  2. Thick Yes, delete this group and all its associated resources
  3. Click on Delete
Delete SharePoint Site
Delete SharePoint Site

Deleting a Classic Site

To delete a classic SharePoint site we need to follow almost the steps. Only the site settings look a bit different than with a modern site. Again, you will need to be a site owner to be able to delete the site.

  1. Open the SharePoint site
  2. Click on the gear icon (Settings)
  3. Choose Site Settings
Delete classic SharePoint Site
  1. Click on Delete this site (under Site Actions)
  2. You will get a warning that you are about to delete the site. Click Delete and then Ok

Deleting a SharePoint site as Administrator

When you are a Global or SharePoint Administrator, then you can also delete the SharePoint sites from the SharePoint Admin Center. You can bulk delete multiple SharePoint sites or of course individual sites.

To delete a single SharePoint sites in the admin center:

  1. Open the SharePoint Admin Center
  2. Expand sites and choose Active Sites
  3. Click or select the site that you want to delete
  4. Click on Delete and again on Delete to confirm it
Delete site in the SharePoint Admin Center
Delete Site from the Admin Center

You can also delete multiple sites from the SharePoint Admin Center:

  1. Select multiple sites that you want to delete
  2. Click on Bulk edit
  3. Choose Delete and confirm your action by clicking on Delete again.
Bulk delete SharePoint sites
Bulk Delete SharePoint sites

Delete SharePoint Site with PowerShell

We can of course also use PowerShell to delete a SharePoint site. Make sure that you have installed the SharePoint module before you continue. Sites that are deleted through PowerShell will also go to the recycle bin first, so you can always restore them when needed.

To delete a classic SharePoint site you can use the cmdlets below. You will need to confirm the delete action after the Remove-SPOSite cmdlet:

# Connect to SharePoint Online Services
Connect-SPOService -Url https://contoso-admin.sharepoint.com

# Remove the SharePoint Site
Remove-SPOSite -Identity https://contoso.sharepoint.com/sites/Lab11 -NoWait

To delete a Modern SharePoint site we will need to use the Exchange Online module in PowerShell. First, connect to Exchange Online and then delete the SharePoint site with the Remove-UnifiedGroup cmdlet:

# Connect to Exchange Online
Connect-ExchangeOnline -UserPrincipalName [email protected]

# Delete the SharePoint site
Remove-UnifiedGroup -Identity "Lab 11"

How to Restore a SharePoint Site

What if you accidentally deleted the wrong SharePoint site or Microsoft 365 Group? As mentioned in the beginning, delete sites are kept for 30 up to 93 days, depending on the SharePoint site type. So, unless you empty the recycle bin, there is an option to restore the SharePoint site.

Tip

Make sure that you have a good backup solution for your Microsoft 365 environment. This way you can always restore the data, even after the 93 days limitation.

We can restore a classic or modern site in the same way in SharePoint Online:

Restore a Deleted SharePoint site

To restore a deleted SharePoint site you will need to open the SharePoint Admin Center. Here we can view the deleted sites list and restore the site:

  1. Open the SharePoint Admin Center
  2. Expand Sites and select Deleted Sites
  3. Select the site and click on Restore
  4. You will get a notification that all other resources also will be restored, click Restore to continue
restore sharepoint site
restore SharePoint site

Finding Inactive SharePoint sites

Before you delete a SharePoint site it’s important to check if the site really isn’t used anymore. Now the challenge these days is that SharePoint sites might not have any file activity for the last 90 days, but the Teams channel is still actively used.

So when unsure we need to check for activity on at least two places, SharePoint and Teams. Let’s start with SharePoint. In the SharePoint Admin Center we can view the last activity on the site, the number of page visits, and files on a site. These three metrics give you a good indication if the site is used or not.

  1. Open the SharePoint Admin Center
  2. Expand Sites > Active sites
  3. Scroll a bit to the right to view the columns Last Activity, Page Visits, and Files

Tip

If you scroll all the way to the right, you can click on Customize Columns and reorder them
Check SharePoint site Activity
Check SharePoint site Activity

If you click on the Last Activity column header, you can also filter the list on Last Activity. This will give you the option for example to view only the sites that never had activity. A good place to start when cleaning up.

find inactive sharepoint sites
find inactive SharePoint sites

If you want to check the activity of a single SharePoint site, then just click on the SharePoint site and open the Activity tab. This will give you all the information you need about the site.

Teams is a bit harder to verify, but we can check the Teams usage report in the Teams Admin Center. If the group isn’t listed in the report then we know that it’s an inactive group.

  1. Open the Teams Admin Center
  2. Expand Analytics & Reports and click on Usage Reports
  3. Choose the Teams usage report and set the date range to last 90 days
  4. Click on Run Report
  5. Only active Teams are listed in the report
list active teams

Permanently Delete a SharePoint site

When you delete a SharePoint Site it will remain in the recycle bin for at least 30 days. Most of the time this isn’t an issue. But what if you accidentally created a normal SharePoint site, while you wanted to create a communication site? You have deleted the normal site, but as you might have noticed, you can’t reuse the site address.

To solve this, we will have to permanently delete the SharePoint site. Keep in mind, that you can’t restore them anymore unless you have a third-party backup solution.

  1. Open the SharePoint Admin Center
  2. Expand sites and click on Deleted sites
  3. Select the deleted site
  4. Click on Permanently delete
Permanently Delete SharePoint site

This option is only not possible when it’s a modern SharePoint site. To permanently delete a modern SharePoint site we will need to use PowerShell. Make sure that you are connected to the SharePoint Online services and that you know the full URL to the SharePoint site:

# Connect to SharePoint Online Services
Connect-SPOService -Url https://contoso-admin.sharepoint.com

# List all deleted SharePoint Sites
Get-SPODeletedSite

# Permanently delete the SharePoint Site
Remove-SPODeletedSite -Identity https://lazydev.sharepoint.com/sites/Lab11
Permanently Delete a SharePoint site with powershell

Wrapping Up

When deleting a SharePoint site make sure that it isn’t used anymore. Of course, you can restore the site from the recycle bin, but it’s better to prevent it. Use the built-in reports or verify it with the site owner or one of its members.

Keep in mind that site owners can also delete SharePoint sites, so I like to configure alerts in Microsoft 365 to detect accidental deletion in time.

I hope you found this article useful, if you have any questions or tips, just drop a comment below.

Leave a Comment

0 Shares
Tweet
Pin
Share
Share