Tuesday, November 20, 2007

Using Feature Receivers to Automate Site Deployment in MOSS 2007

I was inspired by Chris O'Brien's great discussion of feature-based deployment when I started looking at using features myself. I am guessing that the situation which I was in when a web application based on SharePoint had to be fully delivered by development team without reliance on the site masters or the end users to do its configuration is not that uncommon. While the extensive configurability of SharePoint is undoubtfully its essential strength, it also creates practical challanges with regards to development and deployment of custom applications based on SharePoint if these applications also assume minimal or no configuration to be carried out by non-developers.

When a SharePoint-based application is being constructed a lot of things can be configured instead of being coded from scratch as they would be in a custom application, and this is certainly a good thing. The problem is this creates a potential for configuration errors, which are harder to debug than coding errors because you cannot simply step through them in a debugger to determine what went wrong. Another concern is how to ensure proper source control of the pieces of functionality implemented through a series of configuration steps of a SharePoint-based site rather than through the coding. Fortunately WSS and SharePoint expose a powerful API which allows automating the numerous configuration steps. Once configuration steps are automated the chances for configuration errors as well as deployment time reduce greatly, and the functionality which depends on the configuration can now be effectively source controlled.

I have been facing these challenges when I needed to streamline build and deployment process of a web site, which was based on MOSS 2007 Publishing Site template and was in its final development stage. Custom site definition was not used originally, instead a fixed number of pages were added manually to the root site and sub-sites, web parts were placed on the pages, and their properties configured by developers. So here was my challenge: how to deploy the site avoiding repetition of the manual configuration steps each time and how to source control the pages? I have eventually decided to rely on the features, and feature receivers in particular to do what I needed. In the following posts I intend to discuss my approach to automating creation of sub-sites in a site collection, automating page creation, adding web parts, setting their properties and web part connections.

No comments:

Post a Comment