By: Chris Beckett | Updated: 2011-09-01 | Comments | Related: > SharePoint Administration
Problem
SharePoint has never provided an easy way for Administrators to recover a deleted
site, or site collection. The recycle bin, introduced in SharePoint 2007 and supported
on SharePoint 2010, has only supported recovery of list and list items. If a site
or site collection was accidently deleted, the only way to recover was to restore
the site or site collection from a database backup.
Solution
SharePoint 2010 Service Pack 1, released in June 2011, has extended the recycle bin to allow Administrators to recover deleted sites and site collections. In this tip, we will review how to recover sites and site collections from the recycle bin on a SharePoint farm that has been upgraded with Service Pack 1.
For my demonstration, I have created a sample site collection that contains a single sub-site. Let's review how.
Recover a Deleted Site
The Recycle Bin capability is divided into two stages: the first-stage, referred to as the End User Recycle Bin, and a second-stage called the Site Collection Recycle Bin. Normally, when a user deletes a list or list item, the deleted item is saved to the first-stage recycle bin for a period of time, before transitioning to the second-stage recycle bin only available to site administrators.Sub-sites that are deleted within a Site Collection are moved directly to the second-stage recycle bin, and can be found under Site Settings > Site Collection Administration > Recycle Bin.
Within the Site Collection Recycle Bin, administrators can view items from both the End User, and second-stage Recycle Bins. After deleting a site, it will appear in the second-stage recycle bin viewed by selecting the "Deleted from end user Recycle Bin" view.
If you delete a sub-site within a Site Collection, the sub-site can be recovered from the Site Collection Recycle Bin. The Site Collection Recycle Bin, sometimes referred to as the "2nd level" recycle bin is where items are normally moved after they have expired from the User Recycle Bin.
To recover the site, click the checkbox next to the site, and select "Restore Selection".
Recover a Deleted Site Collection
Unfortunately, there is no user interface for restoring deleted site collections. Managing deleted site collections requires using PowerShell. SharePoint 2010 Service Pack 1 introduces 3 new PowerShell CmdLets for managing the Recycle Bin for site collections.
- Get-SPDeletedSite
- Restore-SPDeletedSite
- Remove-SPDeletedSite
The easiest way to get a list of all the deleted site collections is to just call Get-SPDeleteSite without any parameters. In the following example, for brevity, I have formatted the output as a table and filtered the columns displayed. In the second sample, I have added a wildcard filter to the command that can be used to easily filter sites based on relative paths.
Once you have identified the site you want to restore, you call the Restore-SPDeletedSite. To restore one or more sites, it is easiest to just pipe the results from Get-SPDeletedSite. By default, the command will ask you to confirm the restore. To eliminate the confirmation, just add "Confirm:$true" to the end of the command.
Next Steps
- Try deleting and restoring a sample site and site collection.
- Learn more about the recycle bin with this tip: How the Recycle Bin Works in SharePoint.
- Learn more about Get-SPDeletedSite, Restore-SPDeletedSite and Remove-SPDeletedSite on Microsoft TechNet.
- Check out these other tips:
About the author
This author pledges the content of this article is based on professional experience and not AI generated.
View all my tips
Article Last Updated: 2011-09-01