Wednesday 23 July 2014

SharePoint how hide the list and libraries


Hide the lists/Libraries
Sometimes we do feel a need to hide SharePoint Lists. Following are few ways which could some in handy while trying to achieve this objective.
Using SharePoint Designer:
• Start SharePoint Designer and open your site.
• Click on the “Lists and Libraries” in the Navigation pane
• Select the list/library which you need to hide
• On the details page check the “Hide from browser” checkbox and save
To unhide the list un-check the checkbox and save.

Using Code:
SPList has a property as Hidden which can be set to true or false
using (SPSite site = new SPSite("http://YourSiteUrl"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["Announcements"];
//Set this property to true or false accordingly
list.Hidden = false;
list.Update();
}
}