I am writing CAML query to get data from sharepoint list

 <RSSharePointList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <FieldRef Name="Document_x0020_Name" />
     <FieldRef Name="Time_x0020_of_x0020_Upload_x005c" />
<Query><Where><And><Gt><FieldRef Name="Data"/><Value Type="DateTime" IncludeTimeValue="FALSE">
'+StartDate+'</Value></Gt><Lt><FieldRef Name="Data"/><Value Type="DateTime" IncludeTimeValue="FALSE">'+EndDate+'</Value></Lt></And></Where></Query>

However I want one condition to be included in above query. User should select the range of Time_x0020_of_x0020_Upload\Modification to get above values. Startdate and EndDate are two Date/Time paarmetrs


you have to put your filter condition between the Query tag, for example:

<Query><Where><And><Gt><FieldRef Name="Data"/><Value Type="DateTime" IncludeTimeValue="FALSE">'+dateFrom+'</Value></Gt><Lt><FieldRef Name="Data"/><Value Type="DateTime" IncludeTimeValue="FALSE">'+dateTo+'</Value></Lt></And></Where></Query>
  • the type of field is string. Can we manipulate the comparison based on this?
    – Aquarius24
    Mar 30 '15 at 5:25
  • It's better to first convert the String to Date, because if you compare date in string format the "less than" or "greater than" comparison doesn't work correctly
    – Elena
    Mar 30 '15 at 9:14
  • I have edited my question
    – Aquarius24
    Mar 30 '15 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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