Running CQWP on Team Site without publishing infrastructure feature enabled (MOSS 2007)

Content Query Web Part (CQWP) is by far the most useful web part when it comes to render the contents and allowing developers full control over its style and layout. It is bundled as part of MOSS 2007 and it is enabled with Publishing Infrastructure. So if you are using Team Site template then the web part gallery is not  populated with CQWP as one of the option. But you can still run the CQWP without turning on the publishing infrastructure feature.

CQWP needs the “Style Library” (Document Library which hold the xsl style sheets). You can export any of the existing “Style Library” as template and then create a new one based on this template. Now to your surprise “Style Library” cannot be exported as template as you cannot see the option to export.

(Image above of list settings for Style Library which does not shows you the “Save document library as template” option)

(Image above for other document libraries list settings which shows you an option “Save document library as template”)

Lets look at how does the document library gets exported. If you check the URL for the option “Save document library as template” it would be like /_layouts/savetmpl.aspx?List=%7B53C6BE84%2DC6AA%2D4AC3%2DBC7F%2D77195C2E49EC%7D where it calls the savetmpl.aspx and passes the List ID in query string which is URL Encoded. Now we can substitute this list id with one for Style Library which you can obtain from the URL of list settings page of Style Library /_layouts/listedit.aspx?List=%7B749A968E%2DB679%2D4B1B%2D8D73%2D15C06B4CCD5D%7D now you can replace the list settings URL for Style Library and substitute listedit.aspx with savetmpl.aspx easy enough…


Well for you to save time you can download the Template (.STP) file here for Style Library. Now upload this file to the List Template gallery and then create a list based on this template.

Before you try to add the web part you will require this file which is .webpart file download here

To add the web part to the page follow the following steps

  • Site Actions >Edit page
  • Add a Web Part > Advanced Web Part Gallery
  • Switch to the Import mode
  • Browse to the location where you saved the .webpart file and click on “Upload”, after uploading the pane will list the uploaded web part which you can drag to any web part zone to activate
  • Configure and save.

Well this is all you need to do to enable the CQWP where the publishing feature is not enabled.

By Sameer Dhoot

Welcome to my blog. I am IT Professional with 10 years of experience across several IT disciplines. I am currently based in Farmington Hills, Michigan, USA. I hope that you find my blog of interest. It is mostly around Microsoft platform including SharePoint, SQL Server, TFS, Windows OS, Virtualization as this is what I am currently working on, but my aim is to write about all of the competencies described in my profile and write contents which I believe can be helpful to broader audience (IT Pros) and may include general computing advice, how-to's, FAQ, Tips and Tricks. I would welcome contributors and critics who would help to build this blog in terms of better contents and usability.

5 replies on “Running CQWP on Team Site without publishing infrastructure feature enabled (MOSS 2007)”

In case if you decide to enable the publishing feature later just delete the style library which you created and then it should not be a problem trying to activate the publishing feature.

Very helpful thanks. Is there a way to remove the references to the publishing namespace in the webpart file by either
a) substituting a different property definition (there must be a common non-publishing namespace for field operators for instance)
b) creating the equivalent lists in line in the webpart for these selections (e.g. operators, sort direction, etc.)
c) calling them text and making sure we enter valid values when using the webpart on a page.

The Style Library will cause more than a few problems with inquisitive users, so I am trying to get the cqwp without the Style Library.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.