Traitée How to hide "Web Part Gallery" items

  • Sunday, December 26, 2010 9:16 PM
     
     

    I am trying to hide web part gallery items when one clicks "Add Web Part"

    I was able to hide most of the items but I am unable to hide "Lists and Libraries" section which is listed first. Does anyone have any idea on how to hide that? That category does not seem to be part of the web part gallery list.

    Thanks in advance!

All Replies

  • Monday, December 27, 2010 6:56 AM
     
     

    Hey there,

    This link has a solution: http://www.go4sharepoint.com/Forum/hide-lists-libraries-inside-add-web-6932.aspx

    You basically set the list property "Hide from Browsers" to true in SharePoint Designer. This will remove it from "All site Content" and the "Add web part" options.


    Living the SharePoint dream...
  • Monday, December 27, 2010 2:27 PM
     
     

    Thanks for your reply however, I am not trying to hide the lists from "View All Site Content" or from users. I want to hide the category called "Lists and Libraries" from Add A Web Part interface.

    Any other suggestions?

  • Monday, December 27, 2010 2:29 PM
     
     
    In essense, I would like to competely hide that section and not just individual lists.
  • Tuesday, December 28, 2010 5:42 PM
     
     
    Any pointers?
  • Thursday, December 30, 2010 8:27 AM
     
     

    Hi,

     

    SharePoint 2010 uses WebPartAdder[http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.webpartadder.aspx] to add webpart.

    However, I’m afraid it is difficult to add filter for this OOB control.

    2 ideas may could help to throw some light:

     

    ·         Achieve this with pure custom JS code:

    http://blog.symprogress.com/2010/11/ribbon-insert-any-web-part-using-javascript/

     

    ·         Hide the folder with JavaScript in UI(Hide Lists and Libraries div directly <div title="Lists and Libraries" class="ms-wpadder-selected" role="button" style="white-space: nowrap;" index="0">)

     

    Hope this can help.

     

    Best Regards,

    Aaron

  • Monday, January 03, 2011 7:22 PM
     
     

    Hi Aaron,

    I need to spend time reading your first idea but second idea will not work because even if I hide the "Lists and Libraries" item there will still be the section in the middle that will be visible which includes all the lists and libraries. Am I making sense? Because "Lists and Libraries" is the selected item by default when page is loaded and it displays all the lists and libraries.

    Thanks!

  • Monday, January 03, 2011 8:49 PM
     
     Answered

    Found the solution. Thanks to Aaron for pointing me out that WebPartAdder. WebPartAdder has a property called "ShowListsAndLibraries" which can be set to true or false. All I had to do was set it to false and that took care of my requirement. So, in my master page:

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

    • Marked As Answer by diffident Monday, January 03, 2011 8:49 PM
    •