Displaying List Items using Content Query Web Part


Table of Contents

The Content Query Web Part is available with MOSS see more on this under the Web Part Section Content Query Web Part.

Enhanced Content Query Web Part

The Enhanced Content Query Web Part is on CodePlex at http://www.codeplex.com/ECQWP. It basically wraps around the MOSS Content Query Web Part, but allows you to modify the CommonViewFields, XSL Style sheets links amongst other things without exporting the webpart as XML, modifying it and importing it back again

Be Careful!
I found with particular content types that they would not show up in the editor on the right hand side and that I still had to go and export the webpart edit it and import it back for it to work. As soon as you edit it using the Web Part Properties in the UI it'll drop your changes!

Tips

Finding attribute names for XSLT

There is a great bit of guidance here at Content by Query Web Part Rendering Guidance on seeing the attributes and also values that the Content Query Web Part is exposing. Great way to check that your CommonViewFields are coming through.

Filtering by List Template

If you create your own List Templates, you will get away with having the same Type as other List Templates...until you wish to filter by them using the ServerTemplate property of the Content Query Web Part. Ensure that you give you List Template a unique ID see Reserved List Template (ServerTemplate) ID's.

You can get the ServerTemplate ID's via this code:

SPListTemplate listTemplate = web.ListTemplates[listTemplateName];
contentByQueryWebPart.ServerTemplate = Convert.ToString((int)listTemplate.Type);

Multi-choice enabled fields not supported

Be careful when using multi-choice enabled fields, these are not supported by the CQWP.

Labels

webpart webpart Delete
cqwp cqwp Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.



Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. Hosted generously by CustomWare