This is something that I had overlooked in my lengthy posting on SharePoint content types from a couple of months ago. It is about the new UpgradeActions element that you can have in the feature.xml file now and more precisely about the AddContentTypeField element inside it:
<UpgradeActions>
<VersionRange BeginVersion ="1.0.0.0" EndVersion="2.0.0.0" />
<AddContentTypeField ContentTypeId="0x01006DB0361318574E1CAF601F96E79717BB" FieldId="6DB03613-1857-4E1C-AF60-1F96E79717B4" PushDown="TRUE"/>
</UpgradeActions>
So, with this small XML snippet that you can add to your content type feature you will be able to upgrade your sample (already existing) site content type by adding an extra field to its schema and also (more importantly) the change in the schema will be pushed to the inheriting list content types. So far so good – so we already have at least some support out-of-the box for upgrading site content types (if we don’t count the Overwrite attribute that I covered extensively in the “lengthy” posting). But … on second thought it doesn’t look that promising and actually leaves quite some issues open – several that I can think of are that you can only add fields to the content type but cannot remove fields; also the fields will be added after all existing fields in the content type, i.e. you can’t control the field order and not to mention that you can’t change anything in the XmlDocuments section of the content type schema definition. Another thing that bothers me is that these upgrades will look quite “patchy” – you will have your initial content type schema definition in a standard SharePoint item elements file which will be extended by some separate definitions in another file – in this case the feature.xml one. But enough criticism, who knows - we can have something better till the time of the RTM version of SharePoint 2010.
No comments:
Post a Comment