Monthly Archives: December 2011

Using the My Site and build a social network

I usually don’t blog about other blogposts because it doesn’t add any value, but I’d like to make a exception.
I came across the following article about using the My Site as a business social network. It is basic, but I think makes for a very nice entry point for customers starting out with SharePoint 2010.

SharePoint social – Update your My Site and build a business social network

Filter REST call on SharePoint with DateTime value

As you may know, using the REST API in SharePoint 2010 is a very flexible and powerful way to retrieve data from SharePoint. I love the way I can use the ListData.svc to get data form lists and document libraries. Finding the correct syntax however can sometimes be challenging…

Today, I found myself looking for a way of retrieving items from a calendar list. Getting the calendar items themselves wasn’t a problem, try to filter the items for only the current items (today and greater) was.

After some Googling and several syntax attempts I found out the right way to do it.
Say I only want to  get calendar items that start  on November 23, 2011 or beyond…

http://<servername>/_vti_bin/ListData.svc
/Calendar?$filter=StartTime+ge+datetime'2011-11-23T00:00:00'

Works like a charm…

Update March 27, 2012
Because of the question Michal asked I retested some scenario’s. It turns out you cannot filter on time values. Real bummer 🙁
So:

http://<servername>/_vti_bin/ListData.svc
/Calendar?$filter=StartTime+ge+datetime'2011-11-23T09:00:00'

will filter on dates, greater or equal than 2011-11-23. It will not filter on 09:00, so an event taking place at i.e. 08:00 will be returned in the result set.

Therefore, there is no need to specify the time and you can filter without the time part of the query, like this:

http://<servername>/_vti_bin/ListData.svc
/Calendar?$filter=StartTime+ge+datetime'2011-11-23'

If I’m wrong, please let me know…