SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use CrossListQueryInfo to query all Pages Libraries (ServerTemplate 850) across the site collection for a particular custom content type. However, specifying the content type in the query returns no results.

If I leave out the content type clause, results do come back, so the problem probably doesn't lie in the ViewFields.

I suspect my Content Type is broken somehow (filtering on another custom content type works perfectly) but I have no idea where to start.


    <FieldRef Name='ContentType' />
    <Value Type='Text'>Custom News Article</Value>
  <FieldRef Name=\"ArticleStartDate\" Ascending=\"FALSE\"></FieldRef>


CrossListQueryInfo query1 = new CrossListQueryInfo();
query1.Query = clause.ToString(); // See above

if (rowLimit > 0) query1.RowLimit = rowLimit;
query1.ViewFields = viewFields;
query1.Lists = string.Format("<Lists ServerTemplate=\"850\" />");
query1.Webs = "<Webs Scope=\"SiteCollection\" />";
query1.WebUrl = SPContext.Current.Site.RootWeb.ServerRelativeUrl;
share|improve this question
up vote 3 down vote accepted

Maybe late, but the fix is to change <Eq> for <BeginsWith>, using the ContentTypeId. The contenttype of the list item is actually a CHILD of the content type you are searching for.

share|improve this answer
Better late than never. – Rik Mar 2 '12 at 9:29

Try switching your search from a site collection scope to a a recursive search(i.e. Webs Scope="Recursive").

share|improve this answer

I have not done extensive research on this, but I have had similar experiences...

I have not yet found the ultimate answer to this but here are a couple of things you can try:

<Where><Eq><FieldRef Name='ContentTypeId' /><Value Type='Text'>123...</Value></Eq></Where>


<Where><Eq><FieldRef Name='ContentType' /><Value Type='Computed'>MyPageType</Value></Eq></Where>

I have basically been trying out different things untill I got results, and from glancing over my code, these are the ones which are left in the codebase :)

My queries have usually been combined with other conditions involving 'TaxCatchAll' so your mileage may vary.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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