0

I have a question about the upgrade process for features in SharePoint.

In my feature, I'm deploying a custom site template along with a couple of list definitions, webparts, etc. Now when I upgrade these, I deploy a custom element manifest to provision new things onto the site, works ok. But what about new sites being created with the site template? Are those always created and immediately updated with the updates; or should I make sure I also incorporate the new elements in the base manifests themselves?

Also, I tried extending a list with two new views, but I'm not sure how I should do that. I just included the views in the list schema, but that only seems to work for newly created site; existing sites aren't extended with these two new views. I ended up creating a custom code upgrade which deploys the two new views for existing sites, and including the definition in the schema.xml for new sites, but I suppose there's probably a better way to do the same.

2 Answers 2

1

Answering your first question

Yes, you need to include any additional manifests under ElementManifests and UpgradeActions->VersionRange->ApplyManifests both. The reason is that once you deploy a new version of FEATURE, SharePoint replaces older version with new one. And when the updated version is activated, it processes the files under element only. It will NOT process UpgradeActions at all (because is activating current version, not creating older version and upgrading it)

2nd Question

Looking at the nature of change (adding new views to existing list), I think your choice to use code was correct because sharePoint does not support a standalone feature manifest element which can add a view to existing list. Remember, version upgrade supports things like adding a field to existing content type (using AddContentTypeField) as documented here but I have no idea why they do not have things like: AddListView or UpdateListView or RemoveContentTypeField .. it could be a long wish list here :)

1
  • Yes exactly, so when you have to choose you will certainly almost choose the code approach because a couple of things aren't supported in the element files. Which also brings up the question if one should use the element files at all. Since you can provision everything in code just as well, its starting to make more sence to provide everything in code. Upgrading (adding views) would then mean adding a method, and calling it from a) the provision code and b) the upgrade code. With the advantage that the same code will be used in both provisioning and upgrading. Makes sence?
    – Jasper
    Commented Jun 24, 2011 at 12:41
0

If you're referring to WebTemplates you just add your new feature to the onet.xml of the web template and update your solution.

If you're talking about Site definitins (which the title of the post implies) you must not update the site definition but instead use feature stapling to apply the new feature to the sites being created.

2
  • Hi Wictor, it's a site definition. I agree about not updating the site definition, but should I go about upgrading to the correct version. Take the following scenario: - The customer defines a site with list "CustomerData" on it, version 0 - Upgrade 0.1 contains a new list column which I can provision via a feature upgrade. What happens now when I create a new site based on the definition? Will it automatically also update the feature? Since there is no existing feature 0.0 to upgrade?
    – Jasper
    Commented Jun 21, 2011 at 13:57
  • Created a forum thread here social.msdn.microsoft.com/Forums/en-US/… since this isn't a real good place for discussion.
    – Jasper
    Commented Jun 21, 2011 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.