3

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 ?

0

3 Answers 3

3

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.

3
  • ye thats what i have been doing... the biggest issue is, their seems to be a bug with Dataview because even though Title is hidden and not required it wont allow you to save your, update because title is missing data :/... perhaps if i made every reference to title field hidden it would fix this Jul 27, 2012 at 8:01
  • Alternatively you can set the title to optional by using Required="FALSE" in your content type.
    – Stu Pegg
    Jul 27, 2012 at 8:21
  • ye ill try a couple more things next time i have this requirements.:) Jul 30, 2012 at 8:04
0

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>
2
  • if you look at line 35 in the list schema definition i already tried that Jul 19, 2012 at 15:49
  • I didn't look at your code. Jul 19, 2012 at 16:10
0

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>
5
  • That has been done in my content type alreday Jul 20, 2012 at 8:06
  • Ou not in content, I was wrong.. write this piece of code in "List schema definition" it works.
    – Ksesh
    Jul 20, 2012 at 9:04
  • its in their two it was previously title.. so i have changed it to <FieldRefs> <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="LinkTitle" DisplayName="Name" Required="TRUE" Sealed="TRUE" /> still no success Jul 20, 2012 at 14:32
  • Mm.. try my code it works link
    – Ksesh
    Jul 22, 2012 at 18:03
  • did with the previous comment Jul 23, 2012 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.