ShareMyPoint ORDINARY KNOWLEDGE : VIVID THOUGHTS

7Dec/084

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

Posted by Sameer Dhoot under SharePoint

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 thumb Running CQWP on Team Site without publishing infrastructure feature enabled (MOSS 2007)
(Image above of list settings for Style Library which does not shows you the "Save document library as template" option)

withexportoptions thumb Running CQWP on Team Site without publishing infrastructure feature enabled (MOSS 2007)
(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 thumb Running CQWP on Team Site without publishing infrastructure feature enabled (MOSS 2007)

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 thumb Running CQWP on Team Site without publishing infrastructure feature enabled (MOSS 2007)
  • Switch to the Import mode
    importwebpartoption thumb Running CQWP on Team Site without publishing infrastructure feature enabled (MOSS 2007)
  • 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 thumb Running CQWP on Team Site without publishing infrastructure feature enabled (MOSS 2007)
  • Configure and save.

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

Comments (4) Trackbacks (1)
  1. This fix work exactly as described. Thanks. Saved the Day!

  2. This approach brakes the availibility to enable the publishing feature later!

    • Hans,
      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.

  3. 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 comment