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.

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.