Friday 20 June 2014

View Managed Property Values in SharePoint 2013 using Search REST API


When setting up SharePoint 2013 search schema a situation may arise where you want see the values associated with the managed properties you have setup. This can be easily achieved using the Search REST API which was introduced in SharePoint 2013. This API allows us to easily view values for any of the managed properties.

To  view results of a particular query we just need to pass the query as querytext parameter to the REST API as shown below

http://<SharePoint Site>/_api/search/query?querytext='<Your Query>’

This will return only the standard managed properties like author, modified etc. In order to make the search REST API return our custom managed properties we need to pass the property names to selectproperties parameter as shown below

http://<SharePoint Site>/_api/search/query?querytext='<Your Query>’ &selectproperties='<customproperty>'

We can view values for multiple managed properties by passing the property names separated by comma to the selectproperties parameter as shown below

http://<SharePoint Site>/_api/search/query?querytext='<Your Query>’ &selectproperties='<customproperty1>,<customproperty1>,<customproperty3>'

For example the below query to Search REST API will return values for the managed properties Title, Color, Brand as shown in the screen shot

http://MYSPServer/_api/search/query?querytext='Samsung ProXpress'&selectproperties='Title,ColorOWSTEXT,BrandOWSTEXT'
SharePoint 2013 Serch API
 

No comments:

Post a Comment