1
votes

Pretty new to CAML queries, but trying to query a list based on Status = Completed and a date range.

It is throwing the following error "Unexpected Error: One or more field types are not installed properly. Go to the list settings page to delete these fields. Microsoft.SharePoint"

Status and Created are both system columns, so pretty sure I have the Field Names correct I have tested the query without the Date Range and it runs as expected, so I think my problem is somewhere in between and . From what I have read, Created expects time to follow date. Query is below, any help would be greatly appreciated.

<Where>   
<And>                               
   <And>    
      <Eq><FieldRef Name="Status" />Value Type="Choice">Completed</Value></Eq> 
   </And>          
      <Geq>         
         <FieldRef Name="Created" /><Value IncludeTimeValue="TRUE"    
Type="DateTime">2013-07-02T00:00:01Z</Value>
  </Geq>
       <Leq>              
          <FieldRef Name="Created" /><Value IncludeTimeValue="TRUE" 
Type="DateTime">2013-07-02T23:59:59Z</Value>
       </Leq>
</And> 
</Where>
1

1 Answers

1
votes

You have some basic syntax errors in your query above, so they may be causing the issue. See if this helps.

  • You were missing a left angle-bracket in the first tag.
  • You had too many tags and they were out of sequence.
  • I changed the Type attribute of the first tag to Text.

    <Where>   
    <And>    
        <Eq><FieldRef Name="Status" /><Value Type="Text">Completed</Value></Eq> 
        <And>          
            <Geq>         
                <FieldRef Name="Created" /><Value IncludeTimeValue="TRUE" Type="DateTime">2013-07-02T00:00:01Z</Value>
            </Geq>
            <Leq>              
                <FieldRef Name="Created" /><Value IncludeTimeValue="TRUE" Type="DateTime">2013-07-02T23:59:59Z</Value>
            </Leq>
        </And>
    </And> 
    </Where>