SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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>

This Query is written in my JavaScript function.

share|improve this question

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

    <FieldRef Name="Created" />
    <Value Type="DateTime">[Today-5Minute(s)]</Value>
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

Your Answer


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.