development
Inconvenient opening sites – SPSite.OpenWeb()
While working with SharePoint I have stumbled upon quite some inconveniences. Most of the time they were in methods that you don’t use that often, and when you do, you expect them to do something else than they actually do. I probably haven’t worked on a single SharePoint project where I wasn’t instantiating sites. So I was quite surprised when I found out that even something as simple as SPSite.OpenWeb doesn’t always do what you would it expect it to.
Inconvenient programmatically provisioning Web Part instances
Back in October last year I started working with programmatically provisioning Web Part instances. The challenging part was that the assemblies containing the Web Parts’ code were located in the bin directory of the target Web Application. The custom STSADM command I was using for that purpose wasn’t able to resolve the Web Part type. Back then I have found a way to deal with it which I though was a working solution. Unfortunately: just last week I have stumbled upon the same situation: again.
Inconvenient programmatically working with SharePoint users (SPWeb.EnsureUser)
According to the Windows SharePoint Services (WSS) v3 SDK the SPWeb.EnsureUser(String) method is all you need while programmatically working with users. Using nothing more than the login name it checks for you whether the particular user exists in the current web and adds it if required. Within a single line of code it retrieves for you a proper reference to a user no matter the membership/role provider. While it’s really that simple while working in the scope of your SharePoint Web Application, things get slightly more challenging when used in combination with a custom code outside of the HttpContext.
Imtech SharePoint Gems: SPUrlExpressionBuilder
Recently, while working on a SharePoint solution I have rediscovered the SPUrlExpressionBuilder class – one of the many hidden gems of SharePoint 2007. After some research it turned out to be more than the URL tokenizer we know from WSSv3.
Export Publishing Pages to Features – Imtech OCD Export Page v1.0.0.0
Recently I have found that you could actually provision Publishing Pages using the declarative markup of Features. Right after that discovery I have found that you could benefit of that functionality in quite a few scenario’s, like provisioning test content wrapped in Features. The biggest downside against provisioning Publishing Pages would be having to generate the XML manually. To simplify the process I have decided to create a tool which would export the existing Publishing Pages to Feature XML. Guess what: the tool is ready now and you can take a test drive.