Question

I have a list in a SharePoint site where I save some data. That list was created on a Feature activation process months ago!

Now, I have created new improvements like — added 2 new columns to the code (Inside the list creation process in my feature activation method).

My question comes here: Can I redeploy my solution and re-activate my Feature without losing any data in the list?

What's the best way to do that?

Was it helpful?

Solution

For such cases, we usually have a Code Upgrader feature which adds new columns to the list, set default values and so on..

You need to grab the existing list and add the new columns, it should work fine.. And you just need to activate this Code Upgrader Feature

OTHER TIPS

Instead of having a completely new feature, as Arsalan proposes, you can use the Feature Upgrade framework (which is actually mentioned in a comment by tyshock above).

Basically, what you have to do is using the Feature Version attribute, and then implement code to handle the FeatureUpgrading event in a Feature Event Receiver. See best practices here

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