Posted On
Monday, April 20, 2009 9:40 PM
Posted In
Development
One of my pet hates with SharePoint development is the way WebPart entries are left orphaned in the WebPart catalogue when retracting or deactivating features. I spent a bit of time researching this online and although it is mentioned in a few places could not find an exact sample of how to do it programmatically apart from reference to using a SPFeatureReceiver.
After spending some time writing hit and miss code and reading lots of online material I finally got a way to neatly remove these WebPart automatically on retraction and deactivation, and also starter to understand how the SPFeatureReceiver works in SharePoint. I also use Linq to Xml to find the WebPart as a very nice example of how to use the new .Net Framework 3.5 in SharePoint.
The article can be found under the SharePoint section here.