For a list with many views, and some are for background operations and the user does not need to see. Is there a way to prevent some views from displaying in the browser drop down?

  • Search for ctx.ListSchema.ViewSelectorPivotMenuOptions – Danny '365CSI' Engelman Mar 28 '16 at 17:39
  • 2
    Or hide it by settings the SPView.Hidden property. – Bunzab Mar 28 '16 at 17:41

You can do it with couples of ways.

Method # 1, you can do from list setting page.

  • Enable the MetaData Navigation and Filtering site feature from site settings > Site actions > Manage Site Features
  • Now go the List Setting page
  • you will see the "per-location view settings" link.
  • Click on it and remove the All the views which you don't want to display in the drop down.
  • Click Ok. and test it.

    One thing keep in mind, even you hide this but still if somebody know the URL of the view can browse it directly typing URL in the browser.

Another Method is Using the Powershell as other folks responded.

|improve this answer|||||

Try this:

SPList list = site.Lists.TryGetList("Sample");
SPView view = list.Views["SampleView"];
view.Hidden = true;
|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.