Question

I am currently just messing around with defining lists via the elements.xml

Content Type

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- Parent ContentType: EmptyConentType (EmployeeManagement\EmptyContentType) (0x02) -->
  <ContentType ID="0x02002f264075a21e483da3d57561c27dd168"
              Name="EmployeeContentType"
              Group="Custom Content Types"
              Description="My Content Type"
              Inherits="TRUE"
              Version="0">
    <FieldRefs>
      <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"  Name="Title" DisplayName="Name" Required="TRUE" Sealed="TRUE"/>
      <FieldRef ID="{ABD19BB1-87E8-4F9C-9809-5629F180DC82}"  Name="Surname" DisplayName="Surname" Required="TRUE" Sealed="TRUE"/>
      <FieldRef ID="{596379ED-4583-4A38-B9A6-64D0FD55AB37}"  Name="Email" DisplayName="Email" Required="TRUE" Sealed="TRUE"/>
      <FieldRef ID="{86811853-7E52-4515-A88D-A8FA9D450905}"  Name="ContactNumber" DisplayName="Contact Number" Required="TRUE" Sealed="TRUE"/>
    </FieldRefs>
  </ContentType>
  <!-- Surname-->
    <Field ID="{ABD19BB1-87E8-4F9C-9809-5629F180DC82}"
     Name="Surname"
     DisplayName="Surname"
     Type="Text"
     Required="FALSE"
     Group="Person Details"/>
  <!-- Email-->
    <Field ID="{596379ED-4583-4A38-B9A6-64D0FD55AB37}"
     Name="Email"
     DisplayName="Email"
     Type="Text"
     Required="FALSE"
     Group="Person Details"/>
  <!-- ContactNumber-->
    <Field ID="{86811853-7E52-4515-A88D-A8FA9D450905}"
     Name="ContactNumber"
     DisplayName="Contact Number"
     Type="Text"
     Required="FALSE"
     Group="Person Details"/>
</Elements>

List Schema

<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint" Title="EmployeeManagement - EmployeeRegisterDefinition" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/EmployeeManagement-EmployeeRegisterDefinition" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
  <MetaData>
    <ContentTypes>
      <ContentTypeRef ID="0x02002f264075a21e483da3d57561c27dd168"></ContentTypeRef>
    </ContentTypes>
    <Fields>
    </Fields>
    <Views>
      <View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE">
        <Toolbar Type="Standard" />
        <XslLink Default="TRUE">main.xsl</XslLink>
        <RowLimit Paged="TRUE">30</RowLimit>
        <ViewFields>
          <FieldRef Name="LinkTitleNoMenu">
          </FieldRef>
        </ViewFields>
        <Query>
          <OrderBy>
            <FieldRef Name="Modified" Ascending="FALSE">
            </FieldRef>
          </OrderBy>
        </Query>
        <ParameterBindings>
          <ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" />
          <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
          <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" />
        </ParameterBindings>
      </View>
      <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
        <Toolbar Type="Standard" />
        <XslLink Default="TRUE">main.xsl</XslLink>
        <RowLimit Paged="TRUE">30</RowLimit>
        <ViewFields>
          <FieldRef Name="LinkTitle" DisplayName="Name">
          </FieldRef>
          <FieldRef Name="Surname">
          </FieldRef>
          <FieldRef Name="Email">
          </FieldRef>
          <FieldRef Name="ContactNumber">
          </FieldRef>
        </ViewFields>
        <Query>
          <OrderBy>
            <FieldRef Name="ID">
            </FieldRef>
          </OrderBy>
        </Query>
        <ParameterBindings>
          <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
          <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
        </ParameterBindings>
      </View>
    </Views>
    <Forms>
      <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
      <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
      <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
    </Forms>
  </MetaData>
</List>

Result


result:

as you can see their is still a trail of title left in the view. does anyone know how to change this in my list definition ?

Was it helpful?

Solution

Trying to change the display name of the Title is going to be an uphill struggle: There are several versions of the same column, each with their own DisplayName (some of which are created in the list).

If you open your list in SharePoint Manager, you'll see the various hidden Title fields.

My advice would be to hide the title field (Hidden="TRUE" in the Content Type, and remove the FieldRef from the view) and create/use a different column for the person's first name.

OTHER TIPS

In the Schema.xml file of the list instance, where you define your view you can set this.

 <View ...>
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <RowLimit Paged="TRUE">30</RowLimit>
    <ViewFields>
       <FieldRef Name="LinkTitle" DisplayName="Name"></FieldRef>
       ...
    </ViewFields>
    ...
 </View>

You should write your own display name for LinkTitle in content type definition in <Fields> like this

    <Fields>
      <FieldRef Name="LinkTitle" DisplayName="Item22" Required="TRUE" Sealed="TRUE"/>
    </Fields>
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top