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

Print This Post Print This Post

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.

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

WithExportOptions
(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…

ExportOptions

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
    AdvancedWebPartGallery
  • Switch to the Import mode
    ImportWebPartOption
  • 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
    UploadedWebPart
  • Configure and save.

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


Print This Post Print This Post