I have a share point site that I wish to updat开发者_开发百科e programmatically. I.E I want to add a column in a list. I want to capture this in code so that I can run it against dev, test and live. What is the best way to do this.
Using Visual Studio 2010, create a Feature and add a Feature Activated event handler.
here's a tutorial on MSDN on how to add a field to a list.
http://msdn.microsoft.com/en-us/library/aa540133.aspx
I hope the best way is to use powershell script and execute the script on any environment.
Another way is you can create wsp package with ListInstance xml.
I prefer the last choice for writing code in feature activation for creating list. You can refer to my blog for Creating Custom List with powershell.
精彩评论