A colleague was wondering if it is possible at all to rename the Title column in a SharePoint list and I thought it is worth blogging about. First some background info on the Title column for the people who are new to SharePoint development. The Title column is used as the primary column throughout all the lists in SharePoint. The column is of type Text and it exists in 2 more forms: LinkTitle and LinkTitleNoMenu. Title itself simply renders the data stored in the Title column. LinkTitle on the other hand is calculated and renders the data from Title as a hyperlink to the list item along with the drop down menu with commands for that list item. LinkTitleNoMenu is similar to LinkTitle but has no drop down menu. So what needs to be done, is reference these columns and change their display name. So lets do this in a content type associated to a list definition. Most important are the IDs of these 3 columns. I need to put a sticky on my monitor with these IDs since I keep losing them and I use them often:
LinkTitle: {82642ec8-ef9b-478f-acf9-31f7d45fbc31}
LinkTitleNoMenu: {bc91a437-52e7-49e1-8c4e-4698904b2b6d}
Title: {fa564e0f-0c70-4ab9-b863-0177e6ddd247}
So lets start with our Content Type. The content type needs to declare these fields again but provide a different DisplayName. In this case, I called them “Renamed”:
<!–simple text field–>
<Field ID="{d723611e-cb25-43c4-9612-342d08379f81}"
Type="Text"
Name="SampleCTField"
DisplayName="SampleCT Field"
StaticName="SampleCTField"
Hidden="FALSE"
Required="FALSE"
Sealed="FALSE" />
<ContentType ID="0x0100bf4e4d793a2545799782a26331b7be3e"
Name="SampleCT"
Group="Development"
Description="Developing Content Type"
Version="0">
<FieldRefs>
<FieldRef Name="LinkTitle" ID="{82642ec8-ef9b-478f-acf9-31f7d45fbc31}" DisplayName="Renamed" Sealed="TRUE"/>
<FieldRef Name="LinkTitleNoMenu" ID="{bc91a437-52e7-49e1-8c4e-4698904b2b6d}" DisplayName="Renamed" Sealed="TRUE"/>
<FieldRef Name="Title" ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" DisplayName="Renamed" Sealed="TRUE"/>
<FieldRef ID="{d723611e-cb25-43c4-9612-342d08379f81}" Name="SampleCTField" />
</FieldRefs>
</ContentType>
Now we need to associate our Content Type to a List Definition. There are a few “gotchas” here though. So you just edited your copy of schema.xml to include the content type by entering its ID in the ContentTypes section:
<List xmlns:ows="Microsoft SharePoint" Title="SampleList" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/SampleList" BaseType="0" Name="SampleList" Id="ff5184e3-c0db-4b4d-9cae-41315f66c910" Type="100" xmlns="http://schemas.microsoft.com/sharepoint/">
<MetaData>
<ContentTypes>
<ContentTypeRef ID="0x0100bf4e4d793a2545799782a26331b7be3e" />
</ContentTypes>
…
You create an instance of your definition but shockingly you discover your columns are not there and the Title column is not renamed! This is how SharePoint currently behaves. When you add a Content Type to the list definition, the columns are not added automatically; you must declare them in the list definition again. So go to the Fields section of your schema.xml and append your columns:
…<Fields>
<Field ID="{d723611e-cb25-43c4-9612-342d08379f81}" Type="Text" Name="SampleCTField" DisplayName="SampleCT Field" StaticName="SampleCTField" Hidden="FALSE" Required="FALSE" Sealed="FALSE" />
<Field Name="LinkTitle" ID="{82642ec8-ef9b-478f-acf9-31f7d45fbc31}" DisplayName="Renamed" Sealed="TRUE" Type="Calculated"/>
<Field Name="LinkTitleNoMenu" ID="{bc91a437-52e7-49e1-8c4e-4698904b2b6d}" DisplayName="Renamed" Sealed="TRUE" Type="Calculated"/>
<Field Name="Title" ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" DisplayName="Renamed" Sealed="TRUE" Type="Text"/>
</Fields>…
Also do not forget to add your fields to your views. This is another pain in list definition development where the associated content type columns are not visible in the default view. So go to each View element and enter under its ViewFields element your column references. You should find that the Title column is always declared there so go ahead and add any other columns you like. The internal name alone will do just fine:
<ViewFields>
<FieldRef Name="LinkTitleNoMenu">
</FieldRef>
<FieldRef Name="SampleCTField">
</FieldRef>
</ViewFields>
I also uploaded the source code for this example. The project was developed with Visual Studio 2008 SP1 and the x64 version of VSeWSS 1.3 CTP.
http://cid-28159fd1410e3d28.skydrive.live.com/embedrowdetail.aspx/RenameSharePointTitleFieldExample