Question

Now I'm defining a new Custom List Definition within a Custom Content Type, The problem simply is the Title field associated with the list can't be hidden, I have followed some approaches found in the below links but with no success.

Simply adding the List definition without implementing a content type makes the Title field disappeared, but when defining the content type and its fields, it's always visible.

Elements.xml

  <ContentType ID="0x01003EBF692DD17B4F71966712180C0D23D8" Name="ContactUsAssignments"  
               Description="Contact Us Assignments content type">
    <FieldRefs>
      <FieldRef ID="{4B888F48-A039-46D0-B2E1-C67802097069}"/>
      <FieldRef ID="{6238a52d-2975-4e8a-9a1e-31b9cdc74129}"/>
      <RemoveFieldRef ID="{D3D0DDF1-F791-4FFF-893C-0C100B724F1A}" />
    </FieldRefs>
  </ContentType>

I've also tried Inherits="FALSE" Version="0" but unfortunately nothing changed.

Schema.xml

  <ContentTypes>
    <ContentTypeRef ID="0x01003EBF692DD17B4F71966712180C0D23D8"></ContentTypeRef>
</ContentTypes>
<Fields>
  <Field Type="Text" DisplayName="Title" Required="FALSE"
   ID="{D3D0DDF1-F791-4FFF-893C-0C100B724F1A}" StaticName="Title" Name="Title" Hidden="TRUE" />
</Fields>

I don't know exactly if I've missed something, but the approach is clear enough. Thanks.

Was it helpful?

Solution

All the answers mentioned here were tested, but with no success. After many investigations and attributes-combination I've came up with the below answer as the working one.

a. On Elements.xml file on each list Definition make sure that

Inherits="FALSE"

for the Content Type.

Hidden="TRUE" Required="FALSE" DisplayName="_hidden"

for the "Title" field definition.

<ContentType ID="0x01007F465964D8114436BD7D7CF2C2D8CF01" Name="Categories" Group="Category CT" Description="Category content type" Inherits="FALSE">
    <FieldRefs>
      <FieldRef ID="{BA7EBEF9-338B-45DE-9743-E394873060A7}"/>
      <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Hidden="TRUE" Required="FALSE" DisplayName="_hidden" />
    </FieldRefs>
  </ContentType>

b. Remove any reference for Title Field on schema.xml

OTHER TIPS

Here is the method that works for all our projects:

In the element.xml where all your custom content types are defined, add next line to hide "Title" field. Make sure to have the same GUID cause it is OOTB SharePoint Title field:

<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" DisplayName="Title" Required="FALSE" Hidden="TRUE" />

Properties Required="FALSE" and Hidden="TRUE" are crutial. These lines will do it work in the content type.

Another modification is content type definition. It should look like:

<ContentType ID="0x01005E47745D75A5422A9688FDCC0E6E855A"
               Name="Links"
               Group="YourGroup"
               Description="YouDescription
               Inherits="FALSE"
               Version="0">

Inherits="FALSE" is crutial too cause content type should stop inherite default item propeties in order to hide field and make it optional.

Hope it helps,

Andrew

Have you tried adding the Title Field definition in the Elements.xml file above the ContentType definition? I found two examples of adding field definitions to the elements.xml file below. You can try doing that and setting Required to False and Hidden to True and see if that works.

http://msdn.microsoft.com/en-us/library/gg295290%28v=office.14%29.aspx

http://www.codeproject.com/Articles/410880/SharePoint-2010-Creating-a-Custom-Content-Type-usi

I have never done it exactly like this, however I have cheated at times and removed the content types from the List Definition completely (left as < ContentTypes />) and declared the fields like you have in Schema.xml. Doing it in this manner overrode the default Title field for me.

Try to specify removing of Title field in addition with Inherits="False". For example

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!-- Parent ContentType: Item (0x01) 
       Tracked user activity. -->
  <ContentType ID="0x0100c592d12a1dfa42ae8614d54f45118f83"
               Name="User Activity"
               Group="User Activity Tracking"
               Description="Tracked user activity."
               Inherits="FALSE"
               Version="0">
    <FieldRefs>
      <!--Title field inherited from parent Item content type is not required.-->
      <RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" />
      <FieldRef ID="{B2FCBA31-5888-4CB9-BCC8-7B1943161B40}" Name="UserActivityCreatedBy"/>
      <FieldRef ID="{B3F666F7-2DA3-402C-A1A2-A6AA9F4E3E86}" Name="UserActivityType"/>
      <FieldRef ID="{ABF63CC0-6201-44E7-BA8E-4C0116E5B09F}" Name="UserActivityTimeStamp"/>
    </FieldRefs>
  </ContentType>
</Elements>

In list definition add ref to content type

    <ContentTypes>
      <ContentTypeRef ID="0x0100c592d12a1dfa42ae8614d54f45118f83"/>
    </ContentTypes>

And in Fields section don't describe Title field

<Fields>
      <Field ID="{b2fcba31-5888-4cb9-bcc8-7b1943161b40}" Name="UserActivityCreatedBy" Type="User" List="UserInfo" ShowField="Title" UserSelectionMode="0" UserSelectionScope="0" ReadOnlyEnforced="TRUE" Required="TRUE" DisplayName="Created By" StaticName="UserActivityCreatedBy" Group="User Activity Tracking"/>
      <Field ID="{b3f666f7-2da3-402c-a1a2-a6aa9f4e3e86}" Name="UserActivityType" Type="Choice" Format="Dropdown" FillInChoice="FALSE" DisplayName="Type" StaticName="UserActivityType" Group="User Activity Tracking">
        <Default>HttpRequest</Default>
        <CHOICES>
          <CHOICE>Login</CHOICE>
          <CHOICE>HttpRequest</CHOICE>
          <CHOICE>TermsOfUsageAcceptance</CHOICE>
        </CHOICES>
      </Field>
      <Field ID="{abf63cc0-6201-44e7-ba8e-4c0116e5b09f}" Name="UserActivityTimeStamp" Type="DateTime" Format="DateTime" StorageTZ="UTC" DisplayName="Time Stamp" StaticName="UserActivityTimeStamp" Group="User Activity Tracking"/>
    </Fields>

Also don't forget to describe appropriate view - ViewFields section

        <ViewFields>
          <FieldRef Name="UserActivityCreatedBy" />
          <FieldRef Name="UserActivityType" />
          <FieldRef Name="UserActivityTimeStamp" />
        </ViewFields>

Here is a solution which works fine for me:

This is my content type

<ContentType ID="0x0100a2045db65601406a95f8f050642655b7"
               Name="MyContentType"
               Group="Custom Content Types"
               Description="Content Type Description"
               Inherits="FALSE"
               Version="0">
<FieldRefs>
     <!--removing the reference from the Title field-->
      <RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" />

  ....

</FieldRefs>

This is my Schema.xml section with the reference of my content type. You must delete the titlefield from the schema.xml viewfields.

    <ContentTypes>
        <ContentTypeRef ID="0x0100a2045db65601406a95f8f050642655b7"/>
    </ContentTypes>

.....

    <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="MyView" 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="ID"></FieldRef>

              <!--Delete the reference below -->
              <FieldRef Name="LinkTitle"></FieldRef>

            </ViewFields>

.....

This works fine for me! There is still a column named title in my list, but there is not any column named Title in my content type, so it is hidden from newform, editform and viewform pages.

You might consider use some code in an event receiver:

    private void HideTitleFormField(SPList list)
    {
        SPContentTypeCollection listCTCollection = list.ContentTypes;

        foreach (SPContentType ct in listCTCollection)
        {
            SPFieldLinkCollection fieldLinks = ct.FieldLinks;

            //whilst we are here: hide the file name so it cant be edited.
            fieldLinks["Title"].Hidden = true;
            fieldLinks["Title"].Required = false;

            ct.Update();          
        }
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top