I was doing a little monkeying around (read that "book editing") with SharePoint 2010 and decided to see if the similar post I read by Sameer Dhoot was still true in 2010. If you are missing the CQWP in SharePoint, you’ll find that activating the Publishing Infrastructure feature will fix the problem, as the CQWP is added/enabled as part of the Publishing Infrastructure. Well, what if you want to use it in a team site for some reason? Turns out you can still do it.
If you simply export the CQWP from the web part gallery of your publishing site and import it to the web part gallery on your collaboration site, you won’t run into any problems.
You can export the web part by clicking the Edit icon and selecting the Export function in the ribbon.
The problems will start to occur when you try and use it. You’ll get errors when your page on which you’ve added the CQWP attempts to render the web part.
In this version of SharePoint, there is a Style Library in both collaboration and publishing sites. The important difference is that the collaboration site Style Library is empty. This is where the problem resides. You can either copy the content out of the publishing site style library or, you can create a list template out of the publishing style library and save the content with the template.
Since the publishing site does not have a "Save document library as template" link, you’ll have to create one on your own. Navigate to the library settings on your Shared Documents library and select the "Save document library as template" link. You’ll notice that this is using the _layouts/savetmpl.aspx page and it is passing the List GUID as a parameter (/_layouts/savetmpl.aspx?List=%7B1C534D30%2D9F2F%2D41A5%2DAC98%2D51CD244F532D%7D).
Navigate to the publishing site’s Style Library settings page (_layouts/listedit.aspx). Now simply change the listedit.aspx to savetmpl.aspx and press enter. Fill out the form being sure to "Include Content" and save it.
You should get a successful save. Now navigate to the list template gallery.
Right-click and save the list template (STP) on your computer.
Now all you need do is navigate to your site template gallery on your collaboration site and upload the STP file. Then you can delete the existing Style Library and create a new list called Style Library from the template.
You should now feel the love the the CQWP in your collaboration site.
Further investigation shows that the CQWP needs these three style sheets in order to function correctly: ContentQueryMain, Header and ItemStyle. Removing any of these from the Style Library will cause the CQWP to throw an error. So, you could probably just export these styles and import them into your collaboration site’s Style Library and accomplish the same thing.
Didn’t work using just those 3 files mentioned, worked after I saved the entire library and moved it over though.
Cheers!
Excellent post! I just did not want to enable the publishing feature for collaboration sites. I am glad I found this post. Good job!