I see you can make a list hidden by using SharePoint Designer (http://www.sharepointdiary.com/2013/06/how-to-hide-list-or-library-in-sharepoint.html) which I am not interested in.

It is okay if the list is available via the URL.

  • Are you trying to hide the list from specific people or everyone? If it's specific people, why not just remove permissions for those people from the list. Then they won't be able to see it on "All site content" view. – Ramana Viswanadha Apr 11 '16 at 19:26

Try this

var list = ctx.Web.Lists.GetByTitle(listTitle);
list.Hidden = true;

Source: Hide document library using CSOM

Note that in the source they use BreakRoleInheritance to prevent users from accessing the list.

  • 1
    I don't think your code will do anything, as the default value for Hidden should be false. But using true will hide the list (while still letting it be accessible with a direct link). – eirikb Apr 11 '16 at 19:33
  • 1
    The question has a number of javascript tags, this answer is for the C# CSOM instead of the JavaScript JSOM - the answers will certainly be similar but not the same (there is no ExecuteQuery in JSOM) – John-M Apr 11 '16 at 19:40
  • Correct you can see Matt answer in JS – Juan Pablo Pussacq Laborde Apr 11 '16 at 19:51

Thanks for everybody's responses. Close to jpussacq's question I was able to get it working by using the lists hidden attribute by using the set_hidden(true) in the following way:

//JSOM example
 ExecuteOrDelayUntilScriptLoaded(hideListItem, "sp.js");

  function hideListItem(){ 
  var ctx = new SP.ClientContext().get_current();

  var thisList  = ctx.get_web().get_lists().getByTitle('My List');

  //must be updated before loading




  • 1
    I don't think you need to call ctx.load. – eirikb Apr 11 '16 at 19:59
  • 2
    And remember that the content in lists with hidden = true will not be crawled – Anders Aune Apr 11 '16 at 21:44

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.