1,685 articles and 12,533 comments as of Thursday, September 2nd, 2010

Wednesday, November 4, 2009

Warning: Closed Web Parts Ahead

2009-11-03_125312Author: Paul Grenier
jQuery for Everyone

Closed and deleted mean different things in SharePoint.  This causes a lot of confusion among users and administrators and can lead to lengthy troubleshooting sessions.  I will present some simple methods to help you combat this issue.

When a web part gets closed, SharePoint hides it from view.  In fact, SharePoint does not render the data which we expect.  However, I’ve seen evidence that SharePoint still does some processing and may even fetch data in closed web parts.

Take a simple scenario: the supervisor puts a big chart of figures he created using a Data View Web Part on an employee’s main page.  The employee cares nothing for this chart and closes the web part.  The supervisor thinks it was deleted and adds it to the page again.  After a few weeks, they decide to talk it out and agree to put the chart at the bottom of the page.  Now the page is slow.  Why?

First, educate users about Closed vs. Deleted.  Nevermind that we only really need Deleted, just explain the difference.  Second, remove the personalization permission for anyone not trained in this subtle difference.  Third, practice removing Closed as an option on custom web parts.  Fourth, apply additional measures for OOB (out of the box) web parts.

Educate

2009-11-03_123302

Have users go to popular pages or pages that undergo a lot of edits.  Use the Site Actions menu to enter Edit Mode.

2009-11-03_123318

Open the right panel by clicking “Add a Web Part” in one of the content zones.

2009-11-03_123336

In the bottom right of the modal window, click “Advanced Web Part Gallery and options.”

2009-11-03_123433

You may see one or more “Closed Web Parts.”  You can also see a list of closed web parts by entering &Contents=1 at the end of a URL.  Any web parts listed with “No” in the far right column can drain performance and should be deleted if no longer needed.

2009-11-03_125811

Permissions
Not everyone needs the ability to create personalized views in SharePoint, so remove that permission where appropriate for your organization.

2009-11-03_130659

2009-11-03_130833

Disable the Allow Close Option on Web Parts
When you create a new web part, practice removing the “Allow Close” option by entering the advanced properties menu.

2009-11-03_122807

2009-11-03_122847

2009-11-03_122913

2009-11-03_122956

OOB Web Parts
There is no simple fix here without server access and some scripting skills. However, other than repeating the above steps for every single web part on every page in your site collection, you can disable the “Close” functions from the master page with a little JavaScript. You can test this out in a CEWP or add it to your .master for a global effect.

MSOLayout_RemoveWebPartDownLevel = function () { alert('function disabled by admin'); };
MSOLayout_RemoveWebPart = function () { alert('function disabled by admin'); };
 

Please Join the Discussion

5 Responses to “Warning: Closed Web Parts Ahead”
  1. Note for correction – the ‘&Contents=1′ should actually be ‘?Contents=1′. ;o)

  2. Julie Hogge says:

    In regards to “Contents=1″, both are correct.

    It just depends if there are any additional variables in the URL already. If none, ie, mainpage.aspx, then put mainpage.aspx?contents=1. If there are variables already (the ? has already been used), then you cannot use ? again and must add to end of the URL &Contents=1.

    Hope that clears it up a little bit.

  3. Zacharias says:

    I think we understand the difference in closING and hidING web parts, but don’t understand the “need” for a closed web part. It is extremely easy for a user to shoot himself in the foot, especially in a list view page (e.g. /asite/lists/announcements/allitems.aspx).

    Is this just a case of “what were they thinking?” or is there really a justified need for closing a web part as opposed to hiding it?

  4. Adam says:

    Here’s Microsoft’s logic on this one:

    Closing a Web Part is not the same as hiding it or deleting it from the page entirely. In Office SharePoint Designer 2007, a closed Web Part is still visible on the page but appears dimmed. In the browser, a closed Web Part does not appear on the page, but it is stored in the Closed Web Parts Gallery, from where you can open it again. You might close a Web Part for any of several reasons. For example:

    -You don’t currently want to use a particular Web Part on the page, but you have made customizations or personalizations to it that you don’t want to have to reconfigure if you decide to add it back to the page later.

    -Similarly, you may have a Web Part that you want on a page only at certain times. To render the Web Part inactive when it is not wanted, you can close it and then open it when you want it again.

    -If you are creating a custom Web Part that you want to make available to users of a specific page so that they can include it in their personalized views of the page, but you don’t want to make that Web Part available in the larger Web Part gallery for the whole site, you can add the Web Part to the page in shared view, configure the Web Part how you want, and then close it.

    -If a Web Part that you are creating or customizing is causing the page to function incorrectly, you can close that Web Part until you fix it.

    • Adam,

      Thanks for such a comprehensive response. It still leaves the question of interface design, however. We have been taught for 15 years that “x” means delete. By placing the “x” in such a prominent position in the interface, it just BEGS to be clicked. Maybe an interface issue, instead of a functionality issue.

      Mark


Notify me of comments to this article:


Speak and you will be heard.

We check comments hourly.
If you want a pic to show with your comment, go get a gravatar!