SharePoint: Change display name of a field in SharePoint 2010

A user asked a question about changing the display name of a field in a SharePoint list and make it a required field using CSOM (SharePoint 2010 Client object model). Here is how it can be done:

ClientContext clientContext = new ClientContext("http://demo2010a:90"); List list = clientContext.Web.Lists.GetByTitle("Products"); clientContext.Load(list); clientContext.ExecuteQuery(); var fields = list.Fields; clientContext.Load(fields); clientContext.ExecuteQuery(); var field = fields.GetByInternalNameOrTitle("Status"); field.Required = true; field.Title = "StatusB"; field.Update(); clientContext.Load(field); clientContext.ExecuteQuery();
profile for Nadeem Yousuf at SharePoint Stack Exchange, Q&A for SharePoint enthusiasts