“Deleted” SharePoint Web Parts

2 minute read

This one was suggested to me by my friend and colleague Mike Koffman.  He always tries to take the time to go to Advanced in the Modify Web Part panel and take away the user’s ability to "close" the web part.  Here’s the story why.

In working on other people’s sites in SharePoint, I’m often amazed at how many Web Parts are on the pages, but not visible to the users.  This is usually due to false starts in implementation, trying things out and then abandoning them for some reason, etc.

Most people seem to just click the little "X" in the upper corner of the Web Part and assume that it has been deleted.  But no, it’s still there.  If you open the page in SharePoint Designer, you’ll see all of the "ghostie" Web Parts still hanging around.  (I say "ghostie" because they are faded out in the UI.  And because I have a four year old.)

Because the Web Part is still there, SharePoint still has to process it when the page loads.  I heard through the grapevine that a Microsoft engineer said recently that it takes more work for the system to process the Web Part when it’s closed than it does when it’s visible, but I can’t vouch for that.  In any case, SharePoint has to at least read the code for the Web Part to realize that it shouldn’t display it.

To really get rid of the Web Part, you should select the "Delete" option from the menu rather than clicking the "X". The problem is that, once it’s closed, it’s virtually invisible so you don’t even know it still exists. One trick you can use is to navigate to the page and add "?contents=1" to the end of the URL. This gives you a page with a list of all the Web Parts on the page, with a column showing whether the Web Part is open or closed. To get rid of the closed Web Parts, select the check boxes next to them and use the "Delete" option on the toolbar.  The other option is the one which I prefer: open the pages in SharePoint Designer and delete those little "ghosties"!

Technorati tags: , ,

Advertisements

12 Comments

  1. Interesting article – thank you! On a side note, is there a way to easily find out if someone deleted a Web Part in a WSS 2.0 site (from the home page dashboard) ? I looked through the IIS logs, but I’m not 100% sure what to look for.

    Many thanks in advance.

    Reply
  2. Hi Marc, regarding your comment […The other option is the one which I prefer: open the pages in SharePoint Designer and delete those little “ghosties”. …] When I try this in 2013, I get a prompt saying that the page cannot be edited in SP Designer – options then are edit content in browser or edit page layout. Please advise if there is a way to edit a 2013 page in Designer to remove closed webparts. The “contents=1” is giving me errors for this particular page.

    Reply
    • @Chris:
      The message you’re seeing is because you’re trying to edit a publishing page. The two options are what you’ve got available. ?Contents=1 should still work. What’s the error?

      M.

      M.

      Reply
      • Hi Marc,

        When I try to delete one of the closed webparts via the WP Maint Page, the error is “Sorry something went wrong”

        I’m wondering if exceeding the webpart per page limit is blocking me from deleting using the “normal” way.

        So, for publishing pages, the only option then is using the WP Maint Page?

        Reply
        • You can disconnect the page from the page layout, edit it in SPD, and then reconnect it. If you haven’t done that before it can be a little dicey.

          Sometimes when a page “goes bad” it’s just easier to rebuild it. That said, someone who has fixed a lot of broken pages can often get them back.

          M.

          Reply
          • Thanks for the idea. No, I have not disconnected a page and reconnected. I can practice with a test page to see how it goes. I’ll certainly keep the page rebuild idea in mind as well.

            So, just to confirm, after disconnecting the page, the publishing page becomes editable via SPD. and in 2013, that would mean editing the HTML blocks of webpart zones, etc Correct?

            Reply
              • great. THANK YOU!. If I may, on a related note, those closed webparts on that page happen to be old 2007 dataview webparts brought over from our migration to 2013. I did use Laura’s suggestion of how to create new 2013 DVWP (using a view with Basic Table style in then in SPD getting the Web Part Tools tab, saving to gallery, etc.). I was able to add the DVWP on to this page that we are discussing. However, every so often, no all the time, an error pops up when I hit the page saying “List Does Not Exist”. Then, after refreshing, the page renders perfectly. That is my main motivation for wanting to remove those old closed webparts. I’m about 95% certain that the list those older DVWP are pointing does actually exist. I just have not gone through the many of them. Have you seen this kind of intermittent “List does not exist” either with Closed WPs that happen to be DVWP or the error msg associated with DVWP in general? Full error message is: Sorry, something went wrong List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user.

                Reply
                • It sounds like you may have a bunch of Web Parts which you aren’t even using, since they are closed. You should definitely get rid of them, as they can really slow down the page loads. (SharePoint still tries to do some things with them even when they are closed.) In general, unless you are hiding a Web Part temporarily, don’t close them; delete them.
                  My guess on the error message is some sort of timing issue in the page assembly pipeline. Too many Web Parts can sometimes cause that, but without looking into the details, I’m just guessing.

                  M.

                  Reply
                  • Today, I did end up going a few rounds using a test page (creating page, adding two webparts, closing one webpart, opening SPD and detaching page from layout, locating and deleting closed wp, reattaching page to layout in SPD, verifying results.) worked like a charm each time. Thanks again for the tip.

                    Reply

Have a thought or opinion?