Partilhar via


SPContentType.SchemaXml Property

Gets the XML schema that defines the content type.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<ClientCallableAttribute> _
Public ReadOnly Property SchemaXml As String
    Get
'Usage
Dim instance As SPContentType
Dim value As String

value = instance.SchemaXml
[ClientCallableAttribute]
public string SchemaXml { get; }

Property Value

Type: System.String
The XML schema that defines the content type.

Remarks

The value of the SchemaXml property is a string similar to the one shown below, which is returned for the Folder content type.

<ContentType ID="0x0120" Name="Folder" Group="Folder Content Types" 
             Description="Create a new folder." Sealed="TRUE" 
             Version="0" FeatureId="{695b6570-a48b-4a8e-8ea5-26ea7fc1d162}">
  <Folder TargetName="_cts/Folder" />
  <Fields>
    <Field ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" 
           SourceID="https://schemas.microsoft.com/sharepoint/v3" 
           StaticName="ContentType" Group="_Hidden" RowOrdinal="0" 
           Type="Text" DisplayName="Content Type" ReadOnly="TRUE" 
           Sealed="TRUE" ColName="tp_ContentType" 
           PITarget="MicrosoftWindowsSharePointServices" 
           PIAttribute="ContentTypeID" Customization="" />
    <Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" 
           SourceID="https://schemas.microsoft.com/sharepoint/v3" 
           StaticName="Title" Group="_Hidden" Type="Text" 
           DisplayName="Title" Required="FALSE" 
           FromBaseType="TRUE" Hidden="TRUE" Customization="" />
    <Field ID="{8553196d-ec8d-4564-9861-3dbe931050c8}" Name="FileLeafRef" 
           SourceID="https://schemas.microsoft.com/sharepoint/v3" 
           StaticName="FileLeafRef" Group="_Hidden" ShowInFileDlg="FALSE" 
           ShowInVersionHistory="FALSE" Type="File" 
           DisplayName="Name" AuthoringInfo="(for use in forms)" 
           List="Docs" FieldRef="ID" ShowField="LeafName" 
           JoinColName="DoclibRowId" JoinRowOrdinal="0" JoinType="INNER" 
           Required="TRUE" Hidden="FALSE" Customization=""></Field>
  </Fields>
  <XmlDocuments>
    <XmlDocument NamespaceURI="https://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
      <FormTemplates xmlns="https://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
        <Display>ListForm</Display>
        <Edit>ListForm</Edit>
        <New>ListForm</New>
      </FormTemplates>
    </XmlDocument>
  </XmlDocuments>
</ContentType>

The SchemaXml property returns a localized version of the schema. To get a non-localized version, use the SchemaXmlWithResourceTokens property.

See Also

Reference

SPContentType Class

SPContentType Members

Microsoft.SharePoint Namespace

SchemaXmlWithResourceTokens

Other Resources

Content Type Definitions