How to update the default value for the "Title" field in the content type or Document types inherited from it

The Title field is sealed. Any attempts to update the default will reset the value back to "null"


Thank you for your time.

Your idea of ​​doing "RemoveFieldRef and FieldRef back" in this case would be the same as setting the "Required" and "Default" properties through the interface for "Documents" or inherited content types, although your idea will help if we create custom content types ...

Setting the Header on Demand does not work in all situations. One such situation is when you try to add an item via "New" (which in my case opens a template based on Office 2007).

Since "Title" as a required field was giving me a hard time, I wanted to try the "DefaultValue" route, but even this one doesn't seem to work. Any help?

+1


source to share


5 answers


This is what we found for "Title":

  • The "Title" field is not printed in the fieldwss.xml field (12 \ TEMPLATE \ FEATURES \ fields)
  • Not closed under Document content type in ctypeswss.xml (12 \ TEMPLATE \ FEATURES \ ctypes)
  • It is sealed in the document library definition in the schema.xml file (12 \ TEMPLATE \ FEATURES \ DocumentLibrary \ DocLib)


Setting the default through OM will reset to NULL for the .Update () content type. This is because the "Title" is sealed in the DL definition.

Opened a service request with MS. Waiting for results !!!

+1


source


You can remove FIFF and FieldRef again. In fact, the content type of the document does it itself so that the title is not required. The default ctypeswss.xml file does not have an oversized attribute set in the document content type.

Check [12] \ TEMPLATE \ FEATURES \ CTypes \ ctypeswss.xml and scroll down to line 32 to see how the content type does it.



.b

(Disclaimer: I have a high fever, so if I don't have any point, blame the lollipops in my kitchen)

+3


source


Do this with an event listener, which you register with the content type for added items and updated items. This way, whenever a new element is added, it can be given your default name. You can register event receivers in the CAML of the content type, for example:

  <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>

      

+2


source


Hm ... Unless you are using custom content types, I would suggest doing what you want through the function receiver. You can attach this receiver to the default document content type and process your columns as you see fit, such as setting default values, or only setting default values ​​if no custom value was provided.

.b

0


source


This approach works for all fields except the hidden Title field, which seems really special

0


source







All Articles