Scripting deployment of SharePoint 2007 solutions gives you numerous benefits. Not only you will be able to deploy your work in a structured and repeatable manner but it also saves you tons of time which you would otherwise spend on configuring the solution in different environments over and over again. If you’re going to automate your deployment process, you would preferably want to script it all, leaving no manual steps at all. Unfortunately it’s not always possible as both WSS and MOSS teams have protected pieces of the object model which you might need to get the job done. Luckily there are still ways to get to the protected code.
Today, while working on a brand new SharePoint Web Content Management (WCM) solution, I’ve faced quite a challenge: I needed to provision a Content Query Web Part (CQWP) which would query subsites of the current site using a custom Site Definition. Each time user would create a site using that Site Definition, he would get on the home page an aggregation of the content from all underlying sites. It’s more challenging than it sounds and you won’t know it unless you had to do it yourself once.
Stsadm is highly extensible and Gary Lapointe is one of the guys who could tell you everything about it. In order to support the deployment and administration of SharePoint solutions, Gary has created more than 130 custom STSADM commands. One of them – setwebpartstate has recently took my attention. I kept getting errors while importing a subclassed Content Query Web Part (CQWP) – until now…
Some time ago I wrote about provisioning instances of Content Query Web Part (CQWP) in a structured and repeatable way. Just recently I have found out that there is one very important thing you have to be aware of, if you don't want to break the deployment process.
Content Query Web Part (CQWP) is probably the best solution for data aggregation within SharePoint 2007 solutions. The limited functionality exposed through the standard UI is compensated by caching and high performance of the CQWP. Yet there is one thing that can keep you off using the CQWP in environments which require you to deploy your solutions including the configuration in a fully structured and repeatable manner.