How can I prevent subfolders from document libraries appearing in search results in SharePoint online?

I can currently prevent searches and indexing on documents in a document library but I need it to prevent in subfolders rather than the entire document library.

  • You can add certain specific crawl rules and restrict crawler to exclude those items from crawl. – John Zachariah Jul 15 '17 at 3:25

This seems to be what you're looking for - http://blog.cognit.se/sharepoint-search-how-to-filter-out-folders/

I would probably modify the appropriate search verticals and result sources to include the ContentTypeID exclusion for the Folder content type.

  • I don't think this answers the question. I don't see these options to edit the search functionality. I have several subfolders but a archive folder in every subfolder that i need hidden from search results. – Jo Be Jul 13 '17 at 2:00
  • Okay, well, in that case you can't exclude by Content Type ID so you're going to have to create a custom Result Source that excludes any folder with that name, or you could try looking at Result Removal, but then you have to explicitly define the URL to each folder I think. – Thomas Gass Jul 13 '17 at 8:20
  • So, I cant define a parameter that excludes all folders with "Archive" and any files in it? – Jo Be Jul 14 '17 at 17:23
  • Not in such a simple way, no, not to my knowledge. As I said you can use a custom result source that says 'exclude folders called Archive' and point your searches at that, or just manually enter the Archive URLs for Search Result Removal. – Thomas Gass Jul 17 '17 at 10:04
  • There has to be a better way to do this. You would think this would be a common request. The settings allow it for document libraries. What up microsoft?! – Jo Be Jul 18 '17 at 12:46

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.