0

I'm using REST API to get search results from a subsite. What I want to do is to include results from a particular Document Library based on if the property from the user's User Profile is set to true.

  • If property1 = Yes - Include results from DocLib1
  • If property1 = No - DO not include results from DocLib1

Is is possible to do ?

  • Is the document library located on the same subsite or is it somewhere else? – user2536 Aug 3 '16 at 9:42
0

Yes, you'd just have different REST urls with different parameters being passed. The queries would look something like this (not fully tested):

Include:
https://tenant.sharepoint.com/teams/eric/_api/search/query?querytext='IsDocument:True'

Exclude:
https://tenant.sharepoint.com/teams/eric/_api/search/query?querytext='IsDocument:True+-Path:https:%2f%2ftenant.sharepoint.com%2fteams%2feric%2fShared%2520Documents'

The key portion is -Path: to exclude items from the desired path.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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