Change column name of list using SharePoint 2013 client object model in autohosted apps

InfoPath alternatives for form designing SharePoint

In this post we will discuss how to change column name of a list using SharePoint 2013 client object model in autohosted apps.

Also you can check out my previous posts on:
– Rename default Name column in SharePoint 2010 document library

– Add Custom Actions to List Item Menu in SharePoint 2010 Using SharePoint Designer 2010

– Solution: Save Site as Template option not appearing under Site Action Section in Site Settings menu in SharePoint 2010

Before reading this you can check How to Create list using SharePoint 2013 client object model in autohosted apps here as well as how to check if list already exists or not using sharepoint 2013 client object model autohosted apps here.

Below is the full code:
var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);

using (var clientContext = spContext.CreateUserClientContextForSPHost())

{

Web web = clientContext.Web;

List ListName = web.Lists.GetByTitle(“Yours List Name”);

FieldCollection collField = ListName.Fields;

Field oneField = collField.GetByInternalNameOrTitle(“Title”);

oneField.Title = “Thought”; //new column name replace of Title

oneField.Update();

clientContext.Load(collField);

clientContext.Load(oneField);

clientContext.ExecuteQuery();

Response.Write(“Column updated succesfully…”);

}

Similar SharePoint 2013 Tutorials


About Navneet Singh

I am Navneet Singh, Working at C3it software solutions pvt. ltd. in Pune. My core skills are SharePoint 2013, Office 365, SharePoint 2010, SharePoint Designer, SharePoint Designer Workflow, Nintex Workflow, Infopath, Webpart, CSOM/SSOM, Power-shell, C#, ASP.NET and SQL Server.

View all posts by Navneet Singh →

Leave a Reply