6

My Requirements,

I need to search for the file and also files customized properties through rest API but inside a specific folder in SharePoint.

I have used:

https://domain.com/_api/search/query?querytext='Title: Design' /GET

The above rest api returns the search result but it searches in the whole sharepoint document library. For searching the file properties and returing the file properties I have tried:

https://{tenant}.sharepoint.com/_api/search/query?querytext='Title: no'&selectproperties='Title,City,Phase,Job'

But the response from the above query is it returns only the Title but not the all other customized prroperties of the files

How can I achieve my requirements through rest API of SharePoint?

1 Answer 1

3

To search in the specific folder you can specifying full folder path with site: managed property. Like this:

http://{site url}/_api/search/query?querytext='title:{query_text}+site:"{absolute path to folder}"'

Example:

http://server1/_api/search/query?querytext='title:Document*+site:"http:%2f%server1%2fLibrary2%2fFolder3"'

Cannot tell anything about your selectproperties, because everything seams ok, with your query, and SharePoint should return them, if everything is ok with your search schema. Maybe, try to remove empty spaces.

Check if everything is ok, with your search schema, especially managed properties. There should be auto generated managed properties like Title, also all these properties you want to select using selectproperties also should be configured as managed properties with option Selectable

9
  • Do I need to set any setting in the sharepoint for working with the selected properties or search ?
    – Manoj
    Commented Jun 22, 2015 at 4:58
  • The above query is not working for me if i give querytext="no" means it searches the whole sharepoint document library but if i specify a property to search means it doesn't shows any result querytext="Title:no"
    – Manoj
    Commented Jun 22, 2015 at 5:09
  • Check if everything is ok, with your search schema, especially managed properties. There should be auto generated managed properties like Title, also all these properties you want to select using selectproperties also should be configured as managed properties with option Selectable
    – ECM4D
    Commented Jun 22, 2015 at 6:30
  • I have metadata properties such as date,phase,job,area,city etc all are in single line text datatype when i use this property in search querytext it not showing the result what is the problem do i missed anything ?
    – Manoj
    Commented Jun 22, 2015 at 9:01
  • Is properties Selectable and Querable checked for these managed properties. After any change in search schema full crawl is recommended.
    – ECM4D
    Commented Jun 22, 2015 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.