Question

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.

Was it helpful?

Solution

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 :)

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top