Getting Rid of Web Part’s Remains in Sharepoint 2010

So you added a Web Part to a Sharepoint 2010 team site but changed your mind and clicked Cancel. And of course you think the page retains it’s previous state–wrong!

Depending on your actual actions and the previous state of the page it will now contain various remains of that Web part. There are two places to clean up: the hidden Web Part zone and the wiki HTML.

Cleaning the Wiki HTML

Switch the page to edit mode and select the Format Text tab. From the HTML Dropdown select Edit HTML Source. Remove superfluous divs like the highlighted one shown below. The missing nested div gives away that they aren’t genuine.

This wiki HTML is the left column of a wiki based team site. Of course the non-breaking spaces (& #160) don’t have a space between & and #–I had to insert that to make the code show up here.

<!-- Wiki HTML -->
<p class="ms-rteFontSize-6 ms-rteThemeForeColor-7-0" style="font-size:32px">
 <span style="font-size: 32px">
  <span style="font-size: 32px">Welcome to your site! </span>
<p>& #160;</p>
<p>Add a new image, [...] and customize its look. </p>
<p>& #160;</p>
<div class="ms-rtestate-read ms-rte-wpbox" contenteditable="false">
 <div class="ms-rtestate-notify ms-rtegenerate-notify ms-rtestate-read 35b19d09-436c-42d3-b706-fd756665794d" id="div_35b19d09-436c-42d3-b706-fd756665794d"></div>
 <div class="ms-rtestate-read" id="vid_35b19d09-436c-42d3-b706-fd756665794d" style="display: none"></div>
<p>& #160;</p><p>& #160;</p><p>& #160; </p>
<div class="ms-rtestate-read ms-rte-wpbox" contenteditable="false">
 <div id="vid_9b328608-eb9b-4b7b-bd43-fe054afeed95" style="display:none"></div>
<p>& #160;</p>

Cleaning the Hidden Web Part Zone

Adding ?contents=1 to the URL takes you to the Web Part Page Maintenance. Delete every Web part that shouldn’t be there including the Error Web Part. This will remove those Web Parts from the hidden Web Part zone.

If you are interested in more information on the inner workings of a Sharepoint 2010 team site see this post: Adding Web Parts to SharePoint 2010 Wiki Pages using the Client Object Model.

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s