다음을 통해 공유


ContentType Element (ContentType)

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Defines a single content type.

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

Attributes

Attribute

Description

BaseType

Reserved for internal use.

ID

Required Text. Specifies the content type ID of the content type.

Name

Required Text. Specifies the content type name.

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 your columns into logical categories.

DocumentTemplate

Obsolete.

ResourceFolder

Obsolete.

ReadOnly

Optional Boolean. TRUE to define the content type as read-only.

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

Hidden

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

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

Description

Optional Text. Provides a description for the content type, to display in the Windows SharePoint Services user interface.

Sealed

Optional Boolean. TRUE to define the content type as sealed. You must have site collection administrator rights to unseal and edit a content type defined as sealed.

If you do not include this attribute, Windows SharePoint Services treats the content type as if this attributes 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.

FeatureId

Optional Text. Provides the ID of the feature in which the content type is packaged.

Child Elements

FieldRefs Element (ContentType)

Folder Element (ContentType)

Forms Element (ContentType)

XmlDocuments Element (ContentType)

DocumentTemplate Element (ContentType)

Parent Elements

Elements Element (ContentType)

Remarks

For more information about content types, see Content Types.

For more information about assigning content type IDs, see Content Type IDs.

For more information about read-only and sealed content types, see Content Type Change Control.

For more information about hidden content types, see Content Type Access Control.

Example

The following example is the content type definition of the Document content type. The example has been edited for clarity.

<ContentType ID="0x0101"
  Name="$Resources:Document"
  Group="$Resources:Document_Content_Types"
  Description="$Resources:DocumentCTDesc"
  V2ListTemplateName="doclib"
  Version="0">
  <FieldRefs>
    <RemoveFieldRef ID=FID_Attachments Name="Attachments" /> <!-- Attachments -->
    <RemoveFieldRef ID=FID_WorkflowVersion Name="WorkflowVersion" /> <!-- WorkflowVersion -->
…
    <FieldRef ID=FID_SelectFilename Name="SelectFilename" /> <!-- SelectFilename -->
    <FieldRef ID=FID_FileLeafRef Name="FileLeafRef" Required="TRUE"/> <!-- FileLeafRef -->
    <FieldRef ID=FID_Created Name="Created" Hidden="TRUE" /> <!-- Created -->
    <FieldRef ID=FID_Title Name="Title" Required="FALSE" ShowInNewForm="FALSE" ShowInEditForm="TRUE"/> <!-- Title -->            
…
  </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>

See Also

Concepts

Content Type Definition Schema

Content Type Change Control

Content Type Access Control

Other Resources

Content Types