Site and Site Collection Level Recycle Bin

Previously a common question I would get from folks new to SharePoint would be “How do I recover the site I just deleted via the Recycle Bin?” to which unfortunately my reply would be “Umm you don’t.” This was a little scary for some situations since in many cases in SharePoint, we might use a site as a container for a group of documents rather than a folder and it can be a bit of a headache to do a site level restore from a larger backup. Plus let’s face it…If I accidentally delete something, I don’t necessarily want to run off to IT to confess to it.

With SharePoint 2010 Service Pack 1, one of the new features that was introduced was a site and site collection level recycle bin.

Once Service Pack 1 has been installed within your SharePoint environment, deleted sites will appear in the Site Collection Recycle Bin ((Site Settings -> Site Collection Administration -> Recycle Bin) under “Items Deleted From End User Recycle Bin”.

If you have a deleted Site Collection that you need to rescue, you can run a Powershell Command to get your site back.

First you must run the Get-SPDeletedSite command to retrieve information regarding deleted site collections that exist within the farm.

Then once you know the ID of the deleted site collection, you can run the following command.

Restore-SPDeletedSite -Identity ENTER ABOVE VALUE FOR SITEID

And just like that your site collection is restored!

 

 

The Content Query Web Part, A Document Library and An Anonymous User

The title of this post sounds something like a joke but alas it’s no joke but rather an unpleasant error you may encounter at some point using SharePoint Server 2010.

If you have a Content Query Web Part (CQWP) on a page that is pointing to a SharePoint Library (Asset, Picture, or Document), you may discover that an anonymous user will receive an exception error similar to the following when they access the page. 

Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
Correlation ID: Blah Blah Blah

Meanwhile an authenticated user will see the content just fine.  At first, my instinct was to look to see if I had made an error in the custom xsl that I had applied to the web part.  But alas, I then remembered that I do not make errors. (Just kidding!!!) However applying a default style resulted in the same error.  As did pointing the web part to another library and trying different page layouts etc…  I then thought perhaps that a stylesheet was checked out and not published as that might help explain the different behaviour for the different user types.  But again this turned out not to be the issue.

Then I did some searching around and found a great blog post by Waldek Mastykarz that is the solution to the above error.  Essentially the problem is caused by missing values for the CommonViewFields property of your web part.  By exporting the web part, opening it in Notepad and replacing the CommonViewFields property line with Waldek’s suggested properties and importing the web part back onto the page – you are golden!

A big thanks to Waldek for coming up with this fix! Saved me a major headache.