Filtering list data
Using the REST calls, we can issue complicated queries to the SharePoint and get data. In the previous recipe, we got names of all the lists that are present in the site. In this recipe, we will issue a query to our contacts list and filter data based on the LastName
column.
Getting ready
You need to have the contacts list that we created in Chapter 1. Alternatively, create a list called "Contacts" using the Contacts template via the SharePoint user interface and fill in with some data
How to do it...
In order to filter list data, adhere to the following steps:
In Internet Explorer navigate to Tools | Internet Options | Content Tab | Feeds and Web slice settings. Make sure you have checked the Turn off feed reading view in the Advanced section. This time we will receive the data in XML format.
Issue a
Get
request to your SharePoint site:http://YOURSERVERNAME/_vti_bin/listdata.svc/Contacts()?$filter=startswith(LastName,'Kithi')&$select=LastName,FirstName,BusinessPhone...