"Title" field is sealed. Any attempts to update the default value resets the value back to "null"
views:
2004answers:
6How to update default value for "Title" field in "Document" content type or types inherited from it
Hello,
You can RemoveFieldRef and FieldRef it right back in. In fact, the document content type does this itself to make the title not required. In the default ctypeswss.xml there is no sealed attribute set on the Document content type.
Check out [12]\TEMPLATE\FEATURES\CTypes\ctypeswss.xml and scroll down to about line 32 to see how the content type does this.
.b
(Disclaimer: I am running a high fever, so if I don't make any sense, blame the lollipops running around my kitchen)
Hi Bjorn
Thanks for your time.
Your idea of doing "RemoveFieldRef and FieldRef it right back in" would be the same as setting the properties "Required" and "Default Value" through the interface for the "Document" or inherited content types though your idea would help if we are building custom content types.
Setting "Title" to required does not work in all situations. One such situation is when you try to add a item through "New" (which in my case opens up a template based on office 2007).
Since "Title" as required field was giving me hard time, I wanted to try the "DefaultValue" route but even this one does not seem to work. Any help?
Hm... If you are not doing custom content types then I would suggest doing what you want through a feature receiver. You can attach that receiver to the default document content type and handler your columns as you like, for example setting default values or only setting default values if no user value has been provided.
.b
This approach works for all fields except for hidden "Title" field which seems to really special
Do this with a Event Reciever that you register with the Content Type for Items Added and Items Updated Events. This way whenever a new Item is added it can be given your default Title. You can register Event Recievers in the Content Type CAML like such:
<ContentType ...>
<FieldRefs>
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" DisplayName="My Title" Required="FALSE" ShowInDisplayForm="FALSE" ShowInNewForm="FALSE" ShowInEditForm="FALSE" ShowInListSettings="FALSE"/>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
<Receivers>
<Receiver>
<Name>TitleCreator</Name>
<Type>ItemAdded</Type>
<Assembly>...</Assembly>
<Class>TitleCreatorItemEventReceiver</Class>
</Receiver>
<Receiver>
<Name>TitleCreator</Name>
<Type>ItemUpdated</Type>
<SequenceNumber>1</SequenceNumber>
<Assembly>...</Assembly>
<Class>TitleCreatorItemEventReceiver</Class>
</Receiver>
</Receivers>
</XmlDocument>
</XmlDocuments>
</ContentType>
This is what we have found for "Title":
- The “Title” field is not sealed in fieldwss.xml (12\TEMPLATE\FEATURES\fields)
- It’s not sealed under “Document” content type in ctypeswss.xml (12\TEMPLATE\FEATURES\ctypes)
- It is sealed in Document library definition in the schema.xml (12\TEMPLATE\FEATURES\DocumentLibrary\DocLib)
Setting default value through OM would reset the value to NULL on content type .Update(). This is because "Title" is sealed in the DL definition.
Opened a service request with MS. Waiting for the results!!!