How to rename/override the Title field in SharePoint list definition

The first time i started learning about list definitions and content types in SharePoint and how to do all this stuff using Visual Studio, I had only one question! How to do to override the “Title” field or to rename it?

That was not a good practice to make it hidden programmatically with a feature event receiver or something else because we will lose the drop down menu in the list view with the list item commands.

You already have this field in your list default view so try to sort the list items using the Title field from the browser, here we can see in the Url this parameter “SortField=LinkTitle”, this means that the static name of the displayed Title field is “LinkTitle”.

SharePoint doesn’t use only this field by default, we should consider the three following fields:

  • “Title” field with static name = “Title” and ID = {fa564e0f-0c70-4ab9-b863-0177e6ddd247} and Type = Text, used to display the data in the Title column
  • “Title” field with static name =”LinkTitle” and ID = {82642ec8-ef9b-478f-acf9-31f7d45fbc31} and Type =Computed, used to display the same text in the first title field with a hyperlink to the list item and a drop down menu
  • “Title” field with static name =”LinkTitleNoMenu” and ID={bc91a437-52e7-49e1-8c4e-4698904b2b6d} and Type =Computed, the same thing as the second title field but without the drop down menu

So to override correctly this field and get the right display name in the list forms, we need to override its definition in the fields section in the schema.xml file (the list definition file) using its name and its ID to locate it and then another display name, the new one that we need to display, as following:

1

Here we choose to change its display name to “Customer ID”, we suppose that it is still referenced in the “ViewFields” section in the list default view definition.

2

The same display name appears in the NewForm, Edit and DisplayForm.

3

That’s all what you have to do! Just to override the title fields display name in the fields section used in the list definition schema.xml file using their Names, StaticNames and IDs to locate them.

Now it’s time to try it! So Enjoy!

 

 

Advertisements