Cannot modify Title field in Content Type declaration
Problem
Unable to make changes to the title field when declaring a content type in SharePoint 2010. For example, the following declaration has NO EFFECT on the title field being required-
<ContentType ID="0x010092E61E2438E84353B7211741448DE18A" Name="Example" Inherits="TRUE" Version="0"> <FieldRefs> <RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" /> <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Required="FALSE" />
Workaround
Attach a feature receiver to your content type and use the object model to modify the Title field-
SPContentType contentType = site.RootWeb.ContentTypes[ new SPContentTypeId(contentTypeId)]; SPFieldLink title = contentType.FieldLinks["Title"]; title.Required = false; contentType.Update(true);
Discussion
This is a ‘cheap’ solution so to speak because modifying the content type via the object model disconnects it from the XML definition thus making future updates messier (Read More).
I’m a strong advocate of doing things declaratively and this solution clearly violates that rule. A colleague of mine made a case for writing content types completely non-declaratively using the object model.
What best practices do you follow when writing content types?
3 Responses to Cannot modify Title field in Content Type declaration
Leave a Reply Cancel reply
Pages
What I'm Doing...
- What if Apple Designed SharePoint?: http://t.co/HmHXDXUV 3 days ago
- More updates...
Archives
- December 2011
- August 2011
- June 2011
- April 2011
- March 2011
- September 2010
- August 2010
- July 2010
- May 2010
- February 2010
- January 2010
- November 2009
- March 2009
- January 2009
- April 2008
- March 2008
- October 2007
- September 2007
- August 2007
- July 2007
- May 2007
- March 2007
- February 2007
- December 2006
- October 2006
- September 2006
- August 2006
- June 2006
- May 2006
- April 2006
- March 2006
- December 2005
- September 2005
- August 2005
- June 2005
- April 2005
- March 2005
- February 2005
- November 2004
- October 2004
- September 2004
- August 2004
- July 2004
- June 2004
- May 2004
- March 2004
- September 2003
- August 2003
- April 2003
Categories
- Chromium OS
- Internet Explorer 7
- Kwizcom
- Miscellaneous
- Movies
- MS Office
- Music
- Night on the Town
- Office 2007
- Outlook 2007
- Pictures
- Products/Shopping
- Recovered Entries (01/19/2005)
- Restaurants/Food
- Sharepoint 2007 ( MOSS / WSS )
- Sharepoint 2010 (SPS / Foundation)
- Tech
- The Law
- TV
- Uncategorized
- Video Games
- Vista
- Visual Studio 2010
- VMWARE
- VMWARE Server 2.0
- Website
- Windows Live
- Work
- XP





Hi, it is possible to hide the default title field without code . But all the examples found on the internet are incomplete.
The ContentType attribute Inherits should be FALSE. Then you can add a FieldRef ID={default title id} and set hidden to true and the ShowIn..Form attributes to False
Below a complete example:
<elements xmlns="http://schemas.microsoft.com/sharepoint/">
<field Type="Choice" DisplayName="Retention period" Description="What is the retention period" Required="FALSE" EnforceUniqueValues="FALSE" Indexed="FALSE" Format="Dropdown" FillInChoice="FALSE" Group="Custom columns" ID="{8D2407BB-75DA-46A5-80CC-70C1B271D49D}" SourceID="{b30feb85-7edc-4041-9708-9fc8386a8491}" StaticName="RetentionPeriod" Name="RetentionPeriod">
<default>5 year</default>
<choices>
<choice>1 year</choice>
<choice>5 years</choice>
<choice>10 years</choice>
<choice>20 years</choice>
<choice>Permanent</choice>
</choices>
</field>
<contenttype ID="0x0101002EAA7A058444094AA16DDF6ECECBF774" Name="Archivedocument" Description="Create a new archive document." Group="Custom content types" Inherits="false" Hidden="false" ReadOnly="false" Sealed="false">
<fieldrefs>
<fieldref ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Hidden="TRUE" Required="FALSE" ShowInDisplayForm="FALSE" ShowInNewForm="FALSE" ShowInEditForm="FALSE" />
<fieldref ID="{8D2407BB-75DA-46A5-80CC-70C1B271D49D}" Name="RetentionPeriod" DisplayName="Retention period" />
</fieldrefs>
</contenttype>
Ah! Thanks for the tip Pjotr
Thank you so much Pjotr. I lost more than two hours tweaking schema. Changing Inherits to FALSE did the trick.
Thanks!