SharePoint REST Service Filters on Date Only, Not Time

I was recently working on a SharePoint master data management project and ran across a weird issue.

Using SharePoint’s REST services, I needed to select list items that were modified after the last sync job. My query looks like this:

http://localhost/mdm/_vti_bin/ListData.svc/Contacts?$filter=Modified gt datetime'2015-08-27T23:53:00Z'

The result: 0 Rows. After some troubleshooting, turns out that SharePoint ignores the time part of the query. I had to use a “ge” (greater than or equals) operator and filter the time part in memory.

Quick search of the webs confirmed my conclusion: http://itblog.wolthaus.net/2011/12/rest-filter-datetime

This is an inconvenience because I am working on a interval-based synchronization service, it means the same data will be loaded into memory all day long for further filtering.

Leave a Reply

Your email address will not be published. Required fields are marked *