Skip to main content

Mike Geyer's Blog

A fun place to read and collaborate about SharePoint and related technologies.
Go Search
  

Keep in touch: RSS Feed  


I'm a


My company is a


And we deliver

  (we're certified)
Mike Geyer's Blog > Posts > Content Query Web Part (CQWP) for All List Types
Content Query Web Part (CQWP) for All List Types
I was looking for a way to use the Content Query Web Part (CQWP) to pull data from all list types (not just one type) and was surprised to find that this hadn't been documented anywhere.
 
While at Microsoft's SharePoint Conference 2008, I was inspired to spend a little more time looking into the properties available within an exported CQWP.
 
Fortunately, I was able to figure out that there are two properties that can make this happen.  I did have some help from http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spsitedataquery.lists.aspx.  By setting the values following parameters as shown below, you'll produce a list of results that include items from all list types:
  - "ServerTemplate"
  - "BaseType"

 
Quick Instructions
1.  Add a CQWP to a page and configure it to meet your needs for a single list type (for example, all items created by [Me]).
2.  Export the CQWP and save it on your local machine.
3.  Edit the CQWP (should be a .webpart file)
4.  Replace the following properties as shown here:
     <property name="ServerTemplate" type="string"/>
     <property name="BaseType" type="string">0</property>
5.  Save your work.
6.  Import your .webpart
 
I hope this helps.
 
- Mike
 

Comments

Re: Content Query Web Part (CQWP) for All List Types

This will only work for lists based on the generic list type (0).  It will not include document libraries (base type 1).
at 8/9/2009 4:00 PM

Interesting

Re: base type 0 vs. 1

John - I didn't realize that... thanks!

 - Mike G
at 8/9/2009 4:00 PM

 All Posts

Creating a SP List via Excel - Import from Spreadsheet
I've Moved to Hitachi Consulting
SharePoint 2010 Sneak Peak!
Business Intelligence During an Uncertain Time
Keeping In Touch with Family Around the US
Using Javascript to Manipulate a List Form Field
How to Use JavaScript to access SharePoint Query String
First Blog with Windows Live Writer
Microsoft to offer free classes and certification testing
Job Description - SharePoint Solution Architect
SharePoint Blogs as Status Reporting... and community building
Installing MOSS on WinServer 2008 with Hyper-V and SQL08
Keeping up with SP Blogs
Use Search as Content Roll-up
Web browser compatibility in InfoPath Forms Services
Picture Library: Getting to the Thumbnails
All about dates and SPD
Data View Web Part, learn it... love it!
MSFT's SharePoint 2007 Buzz Kit
Content Query Web Part (CQWP) for All List Types
Content Query Web Part (CQWP) with Anonymous Access
My Blog is Live
Examples of Common Formulas
Creating a Form to Add Items to a SharePoint List
Building a Blog Host
Scaling to Extremely Large Lists
Configuring Email Alert Templates
Populating Form Data from SharePoint List Views
SharePoint Designer Workflows and InfoPath Form Libraries
Restoring the Quick Launch Bar in Web Part Pages
Creating a Hyperlink to an InfoPath Form
Changes to SPD Created Workflows
How to find the CSS Class Applied to any SharePoint Element
Publishing an InfoPath 2007 Form Template to a Server Running InfoPath Forms Services
Why you Shouldn't Choose "Enable Rendering on a Mobile Device" when Publishing an InfoPath Form Template
Find Form Template for an Existing Library
Adding a Portal Breadcrumb to your My Site
Define Custom Permission Levels
Exchange 2003 Hotfix (Outlook 2007 and SP Alerts)
Copyright© 1997-2009 Mike Geyer
The posts on this weblog are provided “AS IS” with no warranties, and confer no rights. The opinions expressed herein are personal.