SharePoint 2010 SP1 - Site Recycle Bin

One of the cool new features introduced in SharePoint 2010 SP1 is the Site Recycle Bin feature.

Earlier, the only way to restore deleted sites and site collections required to restore the appropriate content databases. But from SP1 onwards, deleted sites can be recovered from the Site Recycle Bin.

Deleting and Restoring Sites (SPWeb)

When users delete a site, they are presented with the following page:

image

As you can see from the message, the entire site including its contents, permissions are sent to recycle bin.

When you click Delete, you are prompted with another message box, which may be confusing:

image

Even though it says the site will be deleted permanently, it is not.

Hit OK and be happy! Smile

If you are a PowerShell user, you can use the Remove-SPWeb cmdlet to delete the web instead of the UI. Just use the –Recycle parameter:

Remove-SPWeb http://site -Recycle

After the site is deleted, it will be available in the top-level site’s recycle bin to restore:

image

Deleting Site Collections (SPSite)

Unfortunately, if a site collection is deleted, the only way to recover is to use the newRestore-SPDeletedSite cmdlet.

When users delete a site collection, they are presented with the following page:

image

Below are the steps to restore a deleted site collection using PowerShell:

The deleted site collections are stored in the SPDeletedSite object.

The Get-SPDeletedSite cmdlet lists all the deleted site collections:

image

Do remember that the Get-SPDeletedSite returns an array if Get-SPDeletedSite is > 1. Use the following command to get the count:

(Get-SPDeletedSite).Count

All we need to do now is bind this with the Restore-SPDeletedSite cmdlet:

Get-SPDeletedSite | where{$_.SiteId -eq "d48e6455-a1ad-43f4-ac11-a5b558b06ead"} | Restore-SPDeletedSite

image

Use the Remove-SPDeletedSite to permanently remove the deleted site collection. As always, use this with caution.