Updating List Column Names via CSOM

Looking to rename list columns programmatically? Couldn’t be easier:

// Site
string webUrl = "https://my-Site.sharepoint.com/";
// Username
string userName = "my.name@my-Site.onmicrosoft.com";
// Password
SecureString password = new SecureString();
password.AppendChar('P');
password.AppendChar('a');
password.AppendChar('s');
password.AppendChar('s');
password.AppendChar('w');
password.AppendChar('o');
password.AppendChar('r');
password.AppendChar('d');

// Running in context of our site
using (var context = new ClientContext(webUrl))
{
// Credentials
context.Credentials = new SharePointOnlineCredentials(userName, password);
// List name
List myList = context.Web.Lists.GetByTitle("Documents");
// Site column in particular
Field siteCol = myList.Fields.GetByTitle("Title");
// Give it a new name
siteCol.Title = "Document Name";
// Update the column
siteCol.Update();
// Update the list
myList.Update();
// Execute!
context.ExecuteQuery();

}