Aptillon Blog
29Jun/11

SPDeletedSite – quick overview of SP1’s improved recycle bin

Posted by Maurice Prather

With the release of SharePoint 2010 SP1, admins now have the opportunity to work with an improved recycle bin.  Sites and site collections can now be recovered if they have been deleted via the SharePoint browser interface.
Site Recycle Bin Service Pack 1 will introduce long awaited Site Recycle Bin functionality that enables self-service recovery of site collections and sites.   In the past IT Professionals were tasked with restoring entire databases to recover deleted site collections and sites and would generally require expensive restore environments to support the task.  Now in Service Pack 1 administrators can quickly and easily recover site collections and sites accidentally deleted by their owners in a process similar to that of the Recycle Bin we have for Lists, Libraries, and Documents.

(excerpt from SharePoint Team Blog)

How do you get started with recovering your deleted sites?

First, you have to upgrade your databases to SP1.  It is worth calling out this simple fact, because if you don’t you will get an error message that states “Specified method is not supported” when you try to delete a site (funny bug - you can no longer delete sites!). image With your databases upgraded, the next step is to figure out what you want to undelete.  If you have deleted a site and the parent site collection is still up and running, all you need to do is jump over to the Site Collection Recycle Bin.  Your deleted site will appear in the second stage recycle bin (aka “Deleted from end user Recycle Bin”). image Pick the site you want to restore and you’re done.  Note that if you try to restore a child of site that has also been deleted, you need to restore the parent first.  In the image above, if you try to restore “/sites/Asta/Parks/GasWorks/sub1” before restoring the parent “/sites/Asta/Parks/GasWorks”, nothing happens.  In fact, you won’t even get an error message – all you will see is a blank page (another funny bug).  

What about site collections?

If you have deleted a site collection, you no longer have the luxury of going to the Recycle Bin.  You have to switch over to PowerShell.  imageIf you fire up your PowerShell console window, you will find that SharePoint 2010 SP1 has introduced three (3) new commandlets designed to handle deleted site collections. Unfortunately, the built-in PowerShell documentation for these commandlets are lacking.  You will need to pull down the information from MSDN for the new commandlets.
Command Link
Get-SPDeletedSite http://technet.microsoft.com/en-us/library/hh286316.aspx
Remove-SPDeletedSite http://technet.microsoft.com/en-us/library/hh286317.aspx
Restore-SPDeletedSite http://technet.microsoft.com/en-us/library/hh286319.aspx
  If you provide no parameters to Get-SPDeletedSite, it will return the list of all deleted site collections.  This is particularly helpful if you happen to have more than 1 site collection with the same server-relative url. image Restore-SPDeletedSite will restore the site collection based on the parameters specified.  Finally, Remove-SPDeletedSite will purge the site collection from the recycle bin and thus allowing the site to be scheduled for absolute clean-up via the Gradual Site Delete timer job.

Points worth calling out...

There is a notable difference between these commandlets and others.  The SPDeletedSite commandlets only take server-relative urls.  This is pretty important to call out simply because this is a distinct change in behavior compared to other commands which normally take the full url.
6/29/11 update NOTE: There is a difference between Remove-SPSite and Remove-SPWeb! Remove-SPWeb has a new parameter -Recycle that allows an admin to route the deleted SPWeb over to the Recycle Bin. Remove-SPSite did not change with SP1 and therefore all deletions bypass the Recycle Bin.
Finally, it’s also worth mentioning the SPDeletedSite commandlets only work if you have deleted the site collection via the browser ui or the object model.  If you are an admin and you have explicitly called Remove-SPSite, then your site collection is not available to the SPDeleteSite commandlets. -Maurice
Tagged as: ,
To post a comment, view the original posting.