Our client asked us to change list view filtering to not show all terms from taxonomy in managed metadata, but only those from documents in library.

Currently we have two columns:

We have a managed metadata column populated by term taxonomy. When using a filter on the column all values from the taxonomy are visible.


We also have a custom field definition column which inherits from TaxonomyField which in filter view shows only values from documents existing in a library.


I’ve tried to find the way to provide this filtering. After searching it looks like there is no simple way to do this for managed metadata column. Looking at net also didn’t give any conclusive answers. I’ve found only one place where someone asked the same question, but the answers are not satisfactory for my case.

List View Filtering on Manged Metadata Fields

  • We are interested in a resolution to this question, also. I was excited to find another user who is is looking at this same issue. We are also in the process of find a solution to this issue. Have you heard anything back?
    – user10863
    Commented Sep 21, 2012 at 14:43
  • I have ths same requirement. How did you end up solving this issue?
    – user15633
    Commented Mar 15, 2013 at 15:00

2 Answers 2


We were finally able to resolve the issue. In short - to work you need to change the way how OOTB Filter code works to way that it thinks that it is operating with SPFieldLookup.

To achieve this you need 3 steps.

1.Create copy of Filter.aspx file located from Sharepoint Root Directory. This aspx is responsible for rendering items in filter view. 2. Create HttpModule to redirect requests to the customFilter. 3. Register created HttpModule in webconfig.

  1. Replace FilterAspxPage class (the code is in Microsoft.Sharepoint.ApplicationPages.dll) used in this aspx file with custom implementation, which should look like this:

    public partial class CustomFilter : Microsoft.SharePoint.ApplicationPages.FilterAspxPage
        protected new void GetDistinctValues()
        // exact copy of the method GetDistinctValues from Microsoft.Sharepoint.ApplicationPages.dll with code taken from OnInit method
        // to properly initialize objects used in this method
        // Also one use of reflection was needed, because renderAsHtml is protected
        // after assignment to text4 string we've added this condition:
        if (text4.Equals("Microsoft.SharePoint.Taxonomy.TaxonomyField", StringComparison.InvariantCultureIgnoreCase) == true)
            text4 = "Microsoft.SharePoint.SPFieldLookup";
  2. Here is an example of how to create custom HttpModule:

    public class ListFilterRedirectModule : IHttpModule
    #region IHttpModule Members
        public void Dispose()
        public void Init(HttpApplication context)
            context.BeginRequest += new EventHandler(context_BeginRequest);
        private void context_BeginRequest(object sender, EventArgs e)
            HttpApplication application = (HttpApplication)sender;
            HttpContext context = application.Context;
            if (context.Request.RawUrl.IndexOf("/_layouts/filter.aspx", StringComparison.InvariantCultureIgnoreCase) >= 0)
                string newUrl = context.Request.Url.Scheme+"://"+context.Request.Url.Host + context.Request.RawUrl.Replace("/_layouts/filter.aspx", "/_layouts/CustomFilter.aspx");
  3. You will need to configure this module in the web.config file of your web and register it with IIS before being able to use it. For more information of the whole process see the following link: http://go.microsoft.com/?linkid=8101007. Below are sample lines that you can add to the web.config file:

        <modules runAllManagedModulesForAllRequests="true">
            <add name="ListFilterRedirectModule" type="ListFilterRedirectModule, ... , Version=, Culture=neutral, PublicKeyToken=..." />
  • Can you look to my question - sharepoint.stackexchange.com/questions/93953/… ? May be any workarounds or suggestion?
    – Sergey
    Commented Mar 24, 2014 at 9:20
  • Its good article. Some steps are missing in GetDistinctValues(), why did you use text4. Please reply me soon. Thanks Adi
    – user33184
    Commented Sep 8, 2014 at 11:41

You may use this solution from CodePlex: http://metadatapagefilter.codeplex.com/ It has quite some limitations (column must exist as root site, limited to term sets with one level ...) but maybe it can help you.

Read the discussions if you are using IE8 or 9 as it indicates how to work around a infinite loading situation.

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.