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 am trying to filter standard Calendar events via SharePoint web api and my query looks like this:

/_api/web/lists/getbytitle('calendar')/items?$filter=( EventDate  ge  datetime'2013-01-26T22:00:00Z')&$select=Title,EventDate,ID 

Query doesn't work and I receive this error:

The field 'EventDate' of type 'DateTime' cannot be used in the query filter expression

Error Details:

{"error":{"code":"-1, Microsoft.SharePoint.SPException","message":{"lang":"en-US","value":"The field 'EventDate' of type 'DateTime' cannot be used in the query filter expression."},"innererror":{"message":"The field 'EventDate' of type 'DateTime' cannot be used in the query filter expression.","type":"Microsoft.SharePoint.SPException","stacktrace":"   at Microsoft.SharePoint.SPListItemEntityCollectionCamlQueryBuilder.CheckFieldRefUsage(SPField field, FieldRefUsage fieldRefUsage)\r\n   at Microsoft.SharePoint.SPListItemEntityCollectionCamlQueryBuilder.SetFieldRef(XmlWriter writer, String fieldPath, FieldRefUsage fieldRefUsage, Action`1 attributeAction)\r\n   at Microsoft.SharePoint.SPListItemEntityCollectionCamlQueryBuilder.SetWhereBinaryOp(XmlWriter writer, EdmParserNode parseNode)\r\n   at Microsoft.SharePoint.SPListItemEntityCollectionCamlQueryBuilder.SetViewQuery(SPQuery query, XmlWriter writer, StringBuilder sb)\r\n   at Microsoft.SharePoint.SPListItemEntityCollectionCamlQueryBuilder.BuildCamlQuery()\r\n   at Microsoft.SharePoint.SPListItemEntityCollectionCamlQueryBuilder..ctor(SPList list, RESTfulQuery restQuery, Nullable`1 itemId)\r\n   at Microsoft.SharePoint.SPListItemEntityCollection.TryWriteAsOData(ODataWriter writer, RESTfulQuery query, ProxyContext proxyContext)\r\n   at Microsoft.SharePoint.Client.ServerStub.Write(Object value, Uri path, ODataWriter writer, RESTfulQuery query, ProxyContext proxyContext)\r\n   at Microsoft.SharePoint.Client.Rest.RestRequestProcessor.Process()\r\n   at Microsoft.SharePoint.Client.Rest.RestRequestProcessor.ProcessRequest()\r\n   at Microsoft.SharePoint.Client.Rest.RestService.ProcessQuery(Stream inputStream, IList`1 pendingDisposableContainer)","internalexception":{"message":"The field 'EventDate' of type 'DateTime' cannot be used in the query filter expression.","type":"Microsoft.SharePoint.Client.InvalidClientQueryException","stacktrace":""}}}}

Is it possible somehow to use fields type of DateTime in filter query expressions?

Update: I found that I can do this via ListData.svc, e.g.


More details here -

I tried to remove the time part from the /_api/web/ query, e.g.

/_api/web/lists/getbytitle('calendar')/items?$filter=( EventDate  ge  '2013-01-26')&$select=Title,EventDate,ID

But it didn't help and I got the same error.

These queries below don't work:

Query 1:

_api/web/lists/getbytitle('calendar')/items?$filter=( EventDate  ge datetime'2013-01-26T22:00:00Z')&$select=Title,EventDate,ID


/_api/web/lists/getbytitle('calendar')/items?$filter=( EventDate  ge '2013-01-26')&$select=Title,EventDate,ID


The field 'EventDate' of type 'DateTime' cannot be used in the query filter expression

Query 2:

_api/web/lists/getbytitle('calendar')/items?$filter=( EventDate  ge datetime'2013-01-26')&$select=Title,EventDate,ID


The expression "( EventDate ge datetime'2013-01-26')" is not valid
share|improve this question
SharePoint version please? – Robert Kaucher Apr 12 '13 at 19:01
Did you get the answer for the above question? – user41667 Apr 22 '15 at 10:04

You actually have the answer in your question. In your update you show:


Notice the string with the date is prefaced by datetime. You just need to do the same thing in the query you are trying to write.

share|improve this answer
no, it doesn't work for /_api/web query. added these queries to my question. thank you! – Sergey Feb 13 '13 at 15:29

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.