Thursday, June 4, 2009

Rename title field of list programatically in Sharepoint


//Get the site
SPWeb web = SPContext.Current.Web;

// Get the list
SPList list = web.Lists["List Name"];
web.AllowUnsafeUpdates = true;

list.Fields["Title"].Title = "New Title";
list.Fields["Title"].Description = "This is description of field.";
list.Fields["Title"].Update(); //Don't forget to update list field

//Update list
list.Update();
web.AllowUnsafeUpdates = false;

No comments:

Post a Comment