How to edit a column name in Sharepoint ?When O rename a column I can't get by the code to column name.

           if (properties.List.Title == "Wpisy")
           SPList lstOtherList = properties.Web.Lists["Szczegoly"];
           SPListItem item = lstOtherList.AddItem();

           item["Kontrakt"] = properties.AfterProperties["Kontrakt1"];
           item["Pracownik"] = properties.AfterProperties["Pracownik1"];
           item["Dzien"] = properties.AfterProperties["DzienStart"];


I must change a name for columns, and this is works, but i don't want to always build a new list from the begining.


Every column in SharePoint has 3 names:

  • InternalName (just called Name in <Field> and <FieldRef> elements)
  • StaticName
  • DisplayName (called Title in SPField)

InternalName can't be changed after field has been created
StaticName can be changed through code
DisplayName can be changed through code/UI

When accessing data/fields you should always use ID (often from SPBuiltInFieldId), InternalName (often using GetFieldByInternalName and then ID, but also directly as when accessing AfterProperties) or StaticName (often using TryGetFieldByStaticName and then ID)

| improve this answer | |
  • Yes, but i don't want to use CALM. Maybe it is more easy use ? – Grzegorz Z Oct 15 '12 at 18:42
  • But how can I write theme ? In the Label, or console ? – Grzegorz Z Oct 16 '12 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.