0

I want to rename the title column to ItemTitle in sharepoint list. How can i achieve this? I tried the below code:

SPList splist = spWeb.Lists["ListName"];
spWeb.AllowUnsafeUpdates = true;
splist.Fields["Title"].Title = "Item Title";
splist.Fields["Title"].Update();
splist.Update();
spWeb.Update();
spWeb.AllowUnsafeUpdates = false;

This code i am performing on WebProvisioned event. I want that whenvever the new site is created the title column of the particular list should be renamed to "Item Title".

1 Answer 1

0

Try the following:

var field = splist.Fields[SPBuiltInFieldId.Title];
field.Title = "Item Title";
field.Update();

field = splist.Fields[SPBuiltInFieldId.LinkTitle];
field.Title = "Item Title";
field.Update();

field = splist.Fields[SPBuiltInFieldId.LinkTitleNoMenu];
field.Title = "Item Title";
field.Update();

The Title column has other Calculated columns which are used in Views LinkTitle and LinkTitleNoMenu, you need to update these as well.

5
  • Its not working.
    – DRS
    May 20, 2015 at 13:18
  • Actually i have two title column with same display name as "Title". Does the issue is due to this or anything else?
    – DRS
    May 20, 2015 at 13:40
  • Can you check the Internal Name of the columns.. Go to List Settings and click the column, In the URL you will have the Internal Name of the field/column May 20, 2015 at 13:48
  • One is Title1 and one is Title
    – DRS
    May 20, 2015 at 13:50
  • I can change the name of other column but not the Title
    – DRS
    May 20, 2015 at 13:59

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.