Renaming the Title Column in a SharePoint List

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:

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/”&gt;
<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

 

Update: This solution works under SharePoint 2010 & 2013 as well. The only limitation in those editions is that you cannot have more than one Content Type with a different Display Name for the Title column as it is shared with list.

Sample List screenshot, showing the title field renamed to "Renamed"

About these ads

Lead SharePoint Architect @ Advanced 365

Posted in SharePoint
5 comments on “Renaming the Title Column in a SharePoint List
  1. Mario says:

    S’efharisto poli. This posting answered my question perfectly.

  2. Aleksandr says:

    It’s working, thank you!

  3. Tom Phillips says:

    Thank you. That’s a great post.

  4. Just desire to say your article is as astonishing.
    The clarity to your publish is just cool and that i could assume you’re knowledgeable on this subject.
    Fine along with your permission let me to snatch your
    RSS feed to stay updated with impending post. Thanks one million and please keep up the enjoyable
    work.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives
Follow

Get every new post delivered to your Inbox.

Join 100 other followers

%d bloggers like this: