Rename the "Title" Field in a SharePoint List Definition

Posted by | Filed under , , , ,

Sometimes you'll want to override the name of the default (required) "Title" field on a SharePoint list definition. At first, it's a bit confusing how to do so, because to make your "Title" rename comprehensive, you have to change not only the "Title" field's display name, but also "LinkTitle" and "LinkTitleNoMenu".

Luckily, doing so isn't difficult. Either find the fields below in your list definition, or add them in the <Fields/> element. From there, simply change the "DisplayName" attribute (not the "Name" or "StaticName", which should remain unchanged).

<Field DisplayName="Custom Title" ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Type="Text" Name="Title" Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" FromBaseType="TRUE" />
<
Field DisplayName="Custom Title" ID="{bc91a437-52e7-49e1-8c4e-4698904b2b6d}" ReadOnly="TRUE" Type="Computed" Name="LinkTitleNoMenu" DisplayNameSrcField="Title" AuthoringInfo="(linked to item)" EnableLookup="TRUE" ListItemMenuAllowed="Prohibited" LinkToItemAllowed="Prohibited" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="LinkTitleNoMenu" FromBaseType="TRUE">
   <
FieldRefs>
      <
FieldRef Name="Title" />
      <
FieldRef Name="LinkFilenameNoMenu" />
   </
FieldRefs>
   <
DisplayPattern>
         <IfEqual>
            <Expr1>
                <LookupColumn Name="FSObjType"/>
       </
Expr1>
            <Expr2>1</Expr2>
                 <Then>
            <
Field Name="LinkFilenameNoMenu"/>
                </Then>
         <
Else>
            <
HTML><![CDATA[<a onfocus="OnLink(this)" href="]]></HTML>
            <
URL/>
            <HTML><![CDATA[" onclick="EditLink2(this,]]></HTML>
            <
Counter Type="View" />
            <
HTML><![CDATA[);return false;" target="_self">]]></HTML>
            <
Column HTMLEncode="TRUE" Name="Title" Default="(no title)" />
            <
IfEqual>
               <Expr1>
                 <
GetVar Name="ShowAccessibleIcon" />
               </
Expr1>
               <
Expr2>1</Expr2>
               <Then>
                  <HTML><![CDATA[<img src="/_layouts/images/blank.gif" class="ms-hidden" border="0" width="1" height="1" alt="Use SHIFT+ENTER to open the menu (new window)."/>]]></HTML>
               </Then>
            </
IfEqual>
            <HTML><![CDATA[</a>]]></HTML>
            <
IfNew>
               <HTML><![CDATA[<img src="/_layouts/1033/images/new.gif" alt="]]></HTML>
               <
HTML>New</HTML>
               <
HTML><![CDATA[" class="ms-newgif" />]]></HTML>
            </
IfNew>
         </
Else>
      </IfEqual>
   </DisplayPattern>
</Field>
<Field DisplayName="Custom Title" ID="{82642ec8-ef9b-478f-acf9-31f7d45fbc31}" ReadOnly="TRUE" Type="Computed" Name="LinkTitle" DisplayNameSrcField="Title" ClassInfo="Menu" AuthoringInfo="(linked to item with edit menu)" ListItemMenuAllowed="Required" LinkToItemAllowed="Prohibited" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="LinkTitle" FromBaseType="TRUE">
   <FieldRefs>
      <FieldRef Name="Title" />
      <
FieldRef Name="LinkTitleNoMenu" />
      <
FieldRef Name="_EditMenuTableStart2" />
      <
FieldRef Name="_EditMenuTableEnd" />
   </
FieldRefs>
   <DisplayPattern>
   <FieldSwitch>
      <Expr>
         <GetVar Name="FreeForm" />
      </Expr>
      <Case Value="TRUE">
         <Field Name="LinkTitleNoMenu" />
      </Case>
      <Default>
        <Switch>
          <Expr>
             <GetVar Name="MasterVersion" />
          </
Expr>
          <Case Value="4">
             <
HTML><![CDATA[<div class="ms-vb itx" onmouseover="OnItem(this)" CTXName="ctx]]></HTML>
             <
Field Name="_EditMenuTableStart2" />
             <
HTML><![CDATA[">]]></HTML>
             <Field Name="LinkTitleNoMenu" />
             <HTML><![CDATA[</div>]]></HTML>
             <
HTML><![CDATA[<div class="s4-ctx" onmouseover="OnChildItem(this.parentNode); return false;">]]></HTML>
             <HTML><![CDATA[<span>&nbsp;</span>]]></HTML>
             <HTML><![CDATA[<a onfocus="OnChildItem(this.parentNode.parentNode); return false;" onclick="PopMenuFromChevron(event); return false;" href="javascript:;" title="Open Menu"></a>]]></HTML>
             <
HTML><![CDATA[<span>&nbsp;</span>]]></HTML>
             <HTML><![CDATA[</div>]]></HTML>
          </Case>
          <Default>
             <
HTML><![CDATA[<table height="100%" cellspacing="0" class="ms-unselectedtitle itx" onmouseover="OnItem(this)" CTXName="ctx]]></HTML>
             <Field Name="_EditMenuTableStart2" />
             <HTML><![CDATA["><tr><td width="100%" class="ms-vb">]]></HTML>
             <
SetVar Name="ShowAccessibleIcon" Value="1" />
             <Field Name="LinkTitleNoMenu" />
             <
SetVar Name="ShowAccessibleIcon" Value="0" />
             <HTML><![CDATA[</td><td><img src="/_layouts/images/blank.gif" width="13" style="visibility:hidden" alt=""/></td></tr></table>]]></HTML>
          </Default>
       </Switch>
      </Default>
    </FieldSwitch>
   </DisplayPattern>
</Field>

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5