Sharepoint Feature Upgrade (versioning and upgrade)

(my notes from reading Chris O'Brien's blog)

When do we need feature upgrade? Feature upgrade is useful in the following scenarios - To make changes to existing site collections or sites, to add new functionality into an existing Feature, rather than create a new one, where some functionality will be upgraded several times during it's lifecycle etc.

If you're modifying or expanding on functionality developed using Features (across many sites or just one), then Feature upgrade is likely to be a good vehicle to roll out your changes.

QueryFeatures() methods in the API provides a convenient collection to iterate over to apply the changes.


Example of an upgraded Feature:

<?xml version="1.0" encoding="utf-8" ?>

<Feature
xmlns=”http://schemas.microsoft.com/sharepoint/&#8221;
Version=”1.0.0.0″>


<UpgradeActions>


<VersionRange
BeginVersion=”0.0.0.0″
EndVersion=”0.9.9.9″>


<ApplyElementManifests>


<ElementManifest
Location=”SomeFunctionality_Iteration2\Elements.xml”
/>


</ApplyElementManifests>

 


<AddContentTypeField
ContentTypeId=”0x010073f25e2ac37846bb8e884770fb7307c7″


FieldId=”{536DC46C-DC26-4DB0-A97C-7C21E4362A85}”
PushDown=”TRUE”/>


<AddContentTypeField
ContentTypeId=”0x010073f25e2ac37846bb8e884770fb7307c7″


FieldId=”{4E7A6719-011A-47EA-B983-A4941D688CA6}”
PushDown=”TRUE”/>

 
 


<CustomUpgradeAction
Name=”UpdateSomething”>


<Parameters>


<Parameter
Name=”PassSomeValue”>This is a string</Parameter>


</Parameters>


</CustomUpgradeAction>


</VersionRange>

</Feature>

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: