Question

Ok, so what I wan´t to do is to perform a SPSiteDataQuery that gives my all the SPListItems which are of a certain content type and with the field Year of 2008.

<Where>
      <And>
        <BeginsWith>
          <FieldRef Name="ContentTypeId" />
          <Value Type="Text">0x0101010053B766E295F2456DA0470906DC0E36F9</Value>
        </BeginsWith>
        <Eq>
          <FieldRef Name="Year" />
          <Value Type="Number">2008</Value>
        </Eq>
      </And>
    </Where>

I'm setting up my SPSiteDataQuery like the one query above. When I remove the Eq section I get 10 hits (which is correct) but this always turns up 0 (and should be 5). Is there something wrong with the query. Year is a number field but I have also tried using Text (with a contains clause) and Int and Integer.

Any ideas?

EDIT: My bad, The field Year didn´t have a value (mistake in my code). It actually works

Was it helpful?

Solution

My bad, The field Year didn´t have a value (mistake in my code). It actually works

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top