Export (0) Print
Expand All

ContentType Element (ContentType)

Defines a single content type.


<ContentType
  BaseType="Text"
  ID="Text"
  Name="Text"
  Description="Text"
  DocumentTemplate="Text"
  FeatureId="Text"
  Group="Text"
  Hidden="TRUE" | "FALSE"
  Inherits="TRUE" | "FALSE"
  ProgId="Text"
  NewDocumentControl="Text"
  Overwrite="TRUE" | "FALSE
  PushDownChangedResourceFilesOnly="TRUE" | "FALSE
  ReadOnly="TRUE" | "FALSE"
  RequireClientRenderingOnNew="TRUE" | "FALSE"
  ResourceFolder="Text"
  Sealed="TRUE" | "FALSE"
  V2ListTemplateName="Text"
  Version="Integer"
/>

Attribute

Description

BaseType

Reserved for internal use.

ID

Required Text. Specifies the content type ID of the content type. A content type ID has a very specific format. If the value that you assign the ID attribute is not in the correct format, you will get an error when the Feature activates. For more information, see Content Type IDs.

Name

Required Text. Specifies the content type name. The value can be a reference to a resource in the format $Resources:String. For more information, see Localizing SharePoint Solutions.The name itself cannot be longer than 128 characters and cannot contain the characters \ / : * ? " # % < > { } | ~ &, two consecutive periods (..), or special characters such as a tab.

An error occurs if another content type with the same name exists in the collection where the content type is added.

Description

Optional Text. Provides a description for the content type, to display in the SharePoint Foundation user interface. The value can be a reference to a resource in the format $Resources:String.

DocumentTemplate

Obsolete. Use the DocumentTemplate element.

FeatureId

Optional Text. Provides the ID of the feature with which the content type is associated. The value should be the string representation of a GUID structure, including braces.

Group

Optional Text. Specifies the content type group to which the content type is assigned. Content type groups are user-defined groups that help you organize content types into logical categories. The value can be a reference to a resource in the format $Resources:String.

Hidden

Optional Boolean. TRUE to define the content type as hidden. If you define a content type as hidden, SharePoint Foundation does not display that content type on the New button in list views.

If you do not include this attribute, SharePoint Foundation treats the content type as if the attribute was set to FALSE.

Inherits

Optional Boolean. The value of this attribute determines whether the content type inherits fields from its parent content type when it is created.

If Inherits is TRUE, the child content type inherits all fields that are in the parent, including fields that users have added.

If Inherits is FALSE or absent and the parent content type is a built-in type, the child content type inherits only the fields that were in the parent content type when SharePoint Foundation was installed. The child content type does not have any fields that users have added to the parent content type.

If Inherits is FALSE or absent and the parent content type was provisioned by a sandboxed solution, the child does not inherit any fields from the parent.

NewDocumentControl

Optional Text. The programmatic identifier for the preferred application to create a new document of this content type.

Overwrite

Optional Boolean. TRUE to overwrite an existing content type with the same ID.

The default is FALSE.

ProgId

Optional Text. The programmatic identifier for the preferred application to open a document of this content type. This attribute distinguishes between applications that save files with a specified file extension.

PushDownChangedResourceFilesOnly

Optional Boolean. TRUE to copy only changed resource files to derived content types during a push down operation.

The default is FALSE.

ReadOnly

Optional Boolean. TRUE to specify that the content type cannot be edited without explicitly removing the read-only setting. This can be done either in the user interface or in code. For more information, see Content Type Change Control.

If you do not include this attribute, SharePoint Foundation treats the content type as if the attribute was set to FALSE.

RequireClientRenderingOnNew

Optional Boolean. TRUE to require the browser to use the application specified by the ProgId attribute for creating a new item.

The default is TRUE.

ResourceFolder

Obsolete. Use the Folder element.

Sealed

Optional Boolean. TRUE to prevent changes to this content type. You cannot change the value of this attribute through the user interface, but you can change it in code if you have sufficient rights. You must have site collection administrator rights to unseal a content type.

If you do not include this attribute, SharePoint Foundation treats the content type as if the attribute was set to FALSE.

V2ListTemplateName

Optional Text. Specifies the Windows SharePoint Services 2.0 list template type to which this content type maps. For example, the Document content type maps to the Document Library list template.

Version

Reserved for future use.

The following example is the content type definition of the Document content type.

<ContentType ID="0x0101"
  Name="$Resources:Document"
  Group="$Resources:Document_Content_Types"
  Description="$Resources:DocumentCTDesc"
  V2ListTemplateName="doclib"
  Version="0">
  <FieldRefs>
    <RemoveFieldRef ID="{67df98f4-9dec-48ff-a553-29bece9c5bf4}" Name="Attachments" />
    <!-- Attachments -->
    <RemoveFieldRef ID="{f1e020bc-ba26-443f-bf2f-b68715017bbc}" Name="WorkflowVersion" />
    <!-- WorkflowVersion -->
    <RemoveFieldRef ID="{bc91a437-52e7-49e1-8c4e-4698904b2b6d}" Name="LinkTitleNoMenu" />
    <!-- LinkTitleNoMenu -->
    <RemoveFieldRef ID="{82642ec8-ef9b-478f-acf9-31f7d45fbc31}" Name="LinkTitle" />
    <!-- LinkTitle -->
    <RemoveFieldRef ID="{ae069f25-3ac2-4256-b9c3-15dbc15da0e0}" Name="GUID" />
    <!-- GUID -->
    <RemoveFieldRef ID="{de8beacf-5505-47cd-80a6-aa44e7ffe2f4}" Name="WorkflowInstanceID" />
    <!-- WorkflowInstanceID -->
    <FieldRef ID="{5f47e085-2150-41dc-b661-442f3027f552}" Name="SelectFilename" />
    <!-- SelectFilename -->
    <FieldRef ID="{8553196d-ec8d-4564-9861-3dbe931050c8}" Name="FileLeafRef" Required="TRUE"/>
    <!-- FileLeafRef -->
    <FieldRef ID="{8c06beca-0777-48f7-91c7-6da68bc07b69}" Name="Created" Hidden="TRUE" />
    <!-- Created -->
    <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Required="FALSE" ShowInNewForm="FALSE" ShowInEditForm="TRUE"/>
    <!-- Title -->
    <FieldRef ID="{28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f}" Name="Modified"  Hidden="TRUE" />
    <!-- Modified -->
    <FieldRef ID="{822c78e3-1ea9-4943-b449-57863ad33ca9}" Name="Modified_x0020_By" Hidden="FALSE"/>
    <!-- Modified_x0020_By -->
    <FieldRef ID="{4dd7e525-8d6b-4cb4-9d3e-44ee25f973eb}" Name="Created_x0020_By" Hidden="FALSE" />
    <!-- Created_x0020_By -->
  </FieldRefs>
  <XmlDocuments>
    <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
      <FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
        <Display>DocumentLibraryForm</Display>
        <Edit>DocumentLibraryForm</Edit>
        <New>DocumentLibraryForm</New>
      </FormTemplates>
    </XmlDocument>
  </XmlDocuments>
</ContentType>

Community Additions

ADD
Show:
© 2014 Microsoft