我在SharePoint站点中有一个列表,其中我保存一些数据。该列表是在一个特征激活过程上创建的!

现在,我创建了新的改进,如 - 添加了2个新列到代码(在我的功能激活方法中的列表创建过程中)。

我的问题来到这里:我可以重新部署我的解决方案并重新激活我的功能,而不会丢失列表中的任何数据?

是什么最好的方法?

有帮助吗?

解决方案

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

其他提示

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

许可以下: CC-BY-SA归因
scroll top