In this article series:
- Feature upgrade (part 1) – fundamentals
- Feature upgrade (part 2) – a sample to play with (this article)
- Feature upgrade (part 3) – introducing SPFeatureUpgrade kit
- Feature upgrade (part 4) – advanced scenarios
- Feature upgrade (part 5) – using PowerShell to upgrade Features
In my last post I covered some fundamental aspects of SharePoint 2010’s Feature upgrade framework, and covered concepts such as upgrading Features using pure XML (ApplyElementManifests, AddContentTypeField) or shelling out to code (CustomUpgradeAction) to perform the necessary steps. For some reason it feels like Feature upgrade is one of those areas which is slightly harder to get up and running with, possibly because some XML will need to be cranked for some steps, or maybe because coming up with life-like upgrade scenarios with realistic artifacts takes some effort in itself. So, I thought it might be useful if I made available a sample I’ve been using (e.g. in my ALM talks and book chapter) for folks to download and use, in the hope that developers interested in seeing this stuff for themselves might have less work to do.
In addition to providing the source/XML files, I spent some time documenting the exact steps to go through when using the files to ‘execute’ my Feature upgrade scenarios. There’s a 3 page Word document which walks you through the upgrade steps, meaning the sample is effectively a “lab” of the type you might do on a training course:
Similarly, the files provided cover all the different “states” in the process so you can just copy and paste the bits as you go:
The upgrade examples
I came up with the following upgrade scenarios for the sample:
- Upgrade iteration 1 - using ApplyElementManifests and AddContentTypeField to add new fields to a content type and push down to lists using it.
- Upgrade iteration 2 – using CustomUpgradeAction/FeatureUpgrading to pseudo-upgrade a Text field to a Note field, by provisioning a new Note field/running code to iterate list items/copy data from old field to new/mark old field as hidden. (This scenario illustrates that many upgrades require code.)
Download the files from http://sites.google.com/site/sharepointchris/sp2010_featureupgradesample
Feature upgrade is a slightly complex area, and I’m providing a sample that might help if this is an area of SharePoint 2010 you want to look more closely at. I’ve tested the documentation/files, but if anyone uses the sample and hits an issue, feel free to leave a comment here and I’ll do my best to help. The book chapter I wrote contains a rendition of this sample (along with much wider Application Lifecycle Management coverage, as you’d expect), but I thought it would be good to publish it to a wider audience.