Is it possible to use the Content Query web part to filter on multiple specific content types that do not have a parent/child relationship?

I have a requirement to show Events (from a calendar) and Announcements (from an Announcement list) aggregated in the same area but as these come from two different branches in the content type tree, I can't do this via configuration of the web part.

Would I be able to do this with a custom CAML query after exporting/re-importing the web part xml? Also I noticed the following two XML clauses in the webpart.xml file:

<property name="ContentTypeName" type="string" />
<property name="ContentTypeBeginsWithId" type="string" />

Does anyone know if these can take multiple values and if so what is the format?

Are there any other implications to be aware of i.e. do the content types need the same site columns for the fields you want to display?

I'm looking to do this in SP2010 but would be interested to know if the same applied for MOSS.

1 Answer 1


I did need almost the same: select two sets of distinct contenttypes in a CQWP.

After some googling i found that you can override the query of the CQWP with your own CAML-query.

There is the information on msdn, hard to read and lacking complete examples. But that gave me a hint what to look for: QueryOveride and that led me to this msdn forum post which show this example to override the Query:

<property name="QueryOverride" type="string">
          <FieldRef Name="ContentType"/><Value Type="Text">Proposal</Value>
          <FieldRef Name="ContentType"/><Value Type="Text">Document</Value>

Keep in mind that in the webpart xml no linebreaks can be used in the CAML.

Back to your question, besides the query override to select multiple contenttypes there is also a 'ListOverride' in which you can set multiple list:

<property name="ListsOverride" type="string">
      <List ID="81B49BFB-E218-46D4-A697-683FE7F286ED"/>
      <List ID="0CC1695B-1E54-45C5-9825-67DE219A2B4C"/>

(snippet taken from this blog post with more CQWP hack/tweaks.)

  • Great thanks for your answer, I'll test it and mark your answer as correct if it works! :)
    – Jonny
    Dec 20, 2010 at 9:33
  • Jonny, may I know above answer work?
    – Mark L
    Sep 23, 2015 at 3:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.