0

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">
   <ListName>Test</ListName>
   <ViewFields>
     <FieldRef Name="Document_x0020_Name" />
     <FieldRef Name="Time_x0020_of_x0020_Upload_x005c" />
   </ViewFields>
<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>
</RSSharePointList>

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

1 Answer 1

1

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>
3
  • the type of field is string. Can we manipulate the comparison based on this?
    – Aquarius24
    Mar 30, 2015 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, 2015 at 9:14
  • I have edited my question
    – Aquarius24
    Mar 30, 2015 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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