Content Query Web Part (CQWP) in SharePoint
One of the most usable OOTB web parts in SharePoint is Content Query Web Part (CQWP). It has been hugely used in publishing sites. Designer as well as developer always prefer this OOTB component for branding or display the data into the dashboard.
CQWP is for to display the dynamic content in your site (within a list) or within your site collection to the SharePoint webpage (better to say dashboard) in forms in a web part. It is very flexible to setup and easy to use. However it has few limitations as well.
The class name is ContentByQueryWebPart (Namespace: Microsoft.SharePoint.Publishing.WebControls;
Assembly: Microsoft.SharePoint.Publishing (in microsoft.sharepoint.publishing.dll) and this is not CLS-compliant class:
public class ContentByQueryWebPart : CmsDataFormWebPart, INamingContainer, IWebPartVariationUpdate
Check out MSDN for the details of member, fields and constructor for ContentByQueryWebPart and the article How to: Customize the Content Query Web Part by using Custom Properties . You will have a good understanding of its model and how it works.
In Microsoft ECM blog, George Perantatos has been described briefly how to setup and use ContentByQueryWebPart in SharePoint. In MS Office official site, the step-by-step process has been described how to display data from multiple lists with the Content Query Web Part.
Limitation of CQWP: Andrew Connell has mentioned those points in his blog. The pain side is, not to easily implement everything using CQWP as well as limitation on paging mechanism in CQWP.
Ishai Sagi has been introducing the Enhanced Content Query Web Part. This is a very good way to implement paging and eliminating the showstopper in CQWP. Waldek Mastykarz explains how to implement paging in CQWP in his article.
Hope this will help you to understand and the different mechanism to implement CQWP in SharePoint
