Inconvenient Control Adapters

Control Adapters are a great way to modify the presentation layer of any control out there: no matter whether it’s sealed or internal. And while they are pretty easy to setup you can find yourself spending a couple of hours if somehow they seem not to be applied…

Inconvenient programmatically exporting Web Parts

Programmatically provisioning Web Part instances is an important piece of structured and repeatable deployment of SharePoint solutions. Preferably you would like to be able to deploy preconfigured Web Parts at particular places in your SharePoint solution. In order to do that you need two at least things: the target location where do you want to deploy the Web Part instance and the preconfigured Web Part itself. SharePoint Web UI allows you to export Web Parts. While it’s definitely doable to export a couple of them manually, wouldn’t it be better if we could automate the process?

Did you know: Changing existing Site Definitions is unsupported

During the last SharePoint Black Belts meeting we talked about deploying of all kinds of things in SharePoint. One of the topics was deploying and updating custom Site Definitions. Did you know that changing existing Site Definitions is unsupported?

Inconvenient SPWeb.GetListItem (Exception from HRESULT: 0x80070001)

SPWeb ships with the GetListItem method which allows you to retrieve a list item using a URL. While in general you would use the SPContext.Current.ListItem property to get the current list item, there are situations when the GetListItem method becomes really useful, like for example getting the current list item with elevated privileges. There is however one confusing thing about the GetListItem method and if you’re not focused enough, you will spend hours trying to figure out what is wrong.

Programmatically deleting list items/documents with Recycle Bin support

If you delete a document in SharePoint 2007 using the User Interface, it’s being moved to the Recycle Bin, so that it can be restored if necessary. There are situations when you want to include deleting list items and documents in your custom solutions. The most commonly used approach I’ve seen is calling the SPListItem.Delete() method. While this does the job, and deletes the item, it deletes it permanently instead of moving to the Recycle Bin.