Monday, August 26, 2013

Cleaning up deployment of a SharePoint Web Part

 

If you deploy a SharePoint Web Part (especially as a Sandboxed Solution), you may typically follow these steps to remove the SharePoint Web Part:

 

  1. Delete or Remove the Web Part from any Web Part Pages
  2. Deactivate the SharePoint Sandboxed Solution
  3. Delete the SharePoint Sandboxed Solution

However, even after you perform the above steps, the Web Part may continue to linger in the Web Part Gallery.  If you write special code to handle this within your Web Part Solution, you can have it delete the Web Part from the Web Part gallery as part of the deactivation process of your solution.  However, most developers DO NOT typically include such code within their Web Part solutions (You would need to write an Event Receiver to handle the Feature Deactivating event), so it is up to you to manually delete the Web Part from the Web Part Gallery.

Simply open up the Web Part Gallery, select the checkbox for your custom Web Part and delete it.

That is all there is to it!!  This final step is often missed, thus leaving lingering orphaned Web Parts in the Web Part gallery, but now that you know, you can maintain a “clean” Web Part Gallery as part of your SharePoint Site Collections!

No comments:

Post a Comment