I’ve been saying I’m going to start a blog forever now, so this seems like as good a time as any.  I’m so tickled that I found this solution that I’ve spent hours hunting for, that I feel like I must tell the world.

So I was trying to figure out how to hide the “Lists and Libraries” section from the web part gallery in SharePoint 2010 when a user tries to add a web part to their page.  By default when a user clicks “Add a Web Part”, this is placed at the top of the list with the focus, and all lists and libraries are visible:

I had spent several hours researching and tried several different solutions to no avail.  I had tried tinkering with JavaScript and JQuery but couldn’t get it to work.  I was able to hide the “List and Libraries” link with CSS, however the actual list of lists/libraries still displayed on the right.  One thing that does kind of work, is to set each list and library to “hidden” as explained in this forum.  The problem with this solution is that it also hides all the lists/libraries from the All Site Content page, even for admins.

I finally found the solution this morning, thanks to this post.  Basically you just open up the Master Page that your site is using, and add “ShowListsAndLibraries=false” to the WebPartAdder control.  So your markup would look like this:

<WebPartPages:WebPartAdder ID=”WebPartAdder” ShowListsAndLibraries=”false” runat=”server” />

Works like a charm!  Thanks so much to diffident and Aaron Han for figuring this one out!

 

(Visited 83 time, 1 visit today)