0

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?

1

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

1
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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