1

What is the best way to filter a document library based on a Managed Metadata column?

When a user clicks a link in the "Current Navigation", it directs them to a Page with a Document library. I want the document library to already be filtered based on a value in the Managed Meta Data column. Say, for example, the metadata tag I want to filter is "Dinosaurs", the document library needs to show all the documents with the tag "Dinosaurs" (+ optionally all descendent metadata terms).

I know you can create a view on the document library and apply it to the document library web part, but I have many MetaData terms and this isn't an option.

Is there a way to do this via code?

2

1 Answer 1

2

What you are looking for is "Metadata Navigation".

if you go to:

  1. Library settings
  2. Metadata navigation settings
  3. Pick a field under Available Hierarchy Fields

you will get a treeview with terms and the library view will filter based on those terms

you can also have key filters

enter image description here

Source:

https://support.office.com/en-us/article/Configure-metadata-navigation-for-a-list-or-library-a8ddfcd1-a486-4e0f-b1b1-f10ca79fa9bc

3
  • Thanks, I have correctly set this up and the filters work well when viewing all pages of the document library.
    – Philayyy
    Apr 27, 2018 at 2:40
  • Is there a limitation to this working when the doc lib is added to a "page" via a web-part? I have tried to do so and the meta navigation appears in the "Current Navigation", however, when the user clicks the tag, it takes them to the tag's Target Page (specified in the Term Store Management Tool). I was hoping it would filter the doc lib on the page, as it normally does when used directly in the doc lib
    – Philayyy
    Apr 27, 2018 at 2:48
  • the metadata navigation at the site level (which I guess is what you are seeing) is meant to be used as an actual page navigation; you click and you go to the specified page. the library metadata navigation is contextual to the view and MMS term you selected, they are different things. If you really want to filter out the library, I suggest that you use library pages, or build your own (site) mms navigation that links to your page with querystrings for the webpart or something like that Apr 27, 2018 at 8:46

Your Answer

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

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