Question

I want to define a query to return items that satisfy the following :-

  1. if any item have a CT & login user = site column

so i wrote the following :-

<property name="QueryOverride" type="string" >
        <![CDATA[
        <Where>
  <Or>
     <And>
        <Eq>
           <FieldRef Name="ContentType" />
           <Value Type="Text">0x01030039A425F609A70A44BA580AF4A69CB18802</Value>
        </Eq>
        <Eq>
           <FieldRef Name="Technical_x0020_Delivery_x0020_Team" />
           <Value Type="Integer"><UserID Type="Integer" /></Value>
        </Eq>
     </And>
     <And>
        <Eq>
           <FieldRef Name="ContentType" />
          <Value Type="Text">0x01030039A425F609A70A44BA580AF4A69CB18803</Value>
        </Eq>
        <Eq>
           <FieldRef Name="User_x0020_Support_x0020_Delivery_x0020_Team" />
           <Value Type="Integer"><UserID Type="Integer" /></Value>
        </Eq>
     </And>
  </Or>
</Where>]]>

        </property>

but this will not return any result. i wrote this query inside a content query web part .. under the QueryOverride tag and i am providing the CT id +site columns internal names..

EDIt

Now i tried this :-

        <property name="QueryOverride" type="string" >
         <![CDATA[
        <Where>
  <Or>
     <And>
        <Eq>
           <FieldRef Name="ContentTypeId" /> <Value Type="ContentTypeId">0x01030039A425F609A70A44BA580AF4A69CB18802</Value>
        </Eq>
        <Eq>
           <FieldRef Name="Technical_x0020_Delivery_x0020_Team" LookupId="TRUE" />
    <Value Type="Integer"><UserID /></Value>
        </Eq>
     </And>
     <And>
        <Eq>
           <FieldRef Name="ContentTypeId" /> <Value Type="ContentTypeId">0x01030039A425F609A70A44BA580AF4A69CB18803</Value>
        </Eq>
        <Eq>
           <FieldRef Name="User_x0020_Support_x0020_Delivery_x0020_Team" LookupId="TRUE" />
    <Value Type="Integer"><UserID /></Value>
        </Eq>
     </And>
  </Or>
</Where>]]>
        </property>

I can confirm that the site column names are the internal names + the content Types ids are correct...

EDIT-2

now i manage to get the CAML tool working , so i wrote the query as follow (i define to use the SP object model):-

enter image description here

but the result will be empty. as i said i am providing the correct site columns internal names, and the content type ids, so can anyone adivce why i am not getting any results ? and i did not see any exception at the same time ..

Thanks

Was it helpful?

Solution

Update your query to get the user field values like this:

 <FieldRef Name="User_x0020_Support_x0020_Delivery_x0020_Team" LookupId="TRUE" />
    <Value Type="Integer"><UserID /></Value>
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top