Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to fetch the records from List which are created in Last 5 minutes.

I have written following code, but its not working. giving me error.

  <Geq><FieldRef Name='CreatedDate' />
    <Value IncludeTimeValue='TRUE' Type='DateTime'>[Today-5Minute(s)]</Value>
 </Geq>

This Query is written in my JavaScript function.

share|improve this question
add comment

1 Answer

Fieldref name should be 'Created', your query should look like :

<Where>
  <Geq>
    <FieldRef Name="Created" />
    <Value Type="DateTime">[Today-5Minute(s)]</Value>
  </Geq>
</Where>
share|improve this answer
    
No. Its not working for me. [Today-5Minute(s)] gives me error for Expected ']' when I write like this, var dateCriteria = "<And><Leq>" + "<FieldRef Name='Created' />" + "<Value Type='DateTime'>" + [Today-5Minute(s)] + "</Value>" + "</Leq></And>"; –  Shahid Nov 28 '12 at 9:22
    
Here are some observations - Why are you not enclosing [Today-5Minute(s)] with ""? if you dont enclose it i.e. dont make it string then javascript will regard this as javascript variable which is not the case, apart from that you should use Geq for last 5 minues not Leq and if you use <And> then there should be 2 conditions, but I can find only one, you should use the entire text like - var dateCriteria ="<Where><Geq><FieldRef Name='Created' /><Value Type='DateTime'>[Today-5Minute(s)]</Value></Geq></Where>"; –  Diptarag Nov 28 '12 at 9:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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