コンテンツ タイプ定義

最終更新日: 2010年3月28日

適用対象: SharePoint Foundation 2010

この記事の内容
XML スキーマ定義
要素

コンテンツ タイプ定義スキーマでは、フィーチャーの要素マニフェスト ファイルでコンテンツ タイプを作成する XML の構造を定義します。

XML スキーマ定義

コンテンツ タイプを定義する要素マニフェストは、wss.xsd ファイル内のスキーマで検証する必要があります。このファイルは %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\XML にあります。

要素

次のリストは、スキーマ定義の要素間の関係を示しています。

<Elements 要素 (ContentType)>

   <ContentType 要素 (ContentType)>

      <Folder 要素 (ContentType)>

      <FieldRefs 要素 (ContentType)>

         <FieldRef 要素 (ContentType)>

         <RemoveFieldRef 要素 (ContentType)>

      <XmlDocuments 要素 (ContentType)>

         <XmlDocument 要素 (ContentType)>

      <DocumentTemplate 要素 (ContentType)>

次の例は、2 つのファイルをドキュメント テンプレートとして使用するように準備して、4 つのユーザー設定サイト列と 3 つのサイト コンテンツ タイプを作成するフィーチャーの要素マニフェストを示しています。最初の新しいコンテンツ タイプ Financial Document は、組み込みの Document コンテンツ タイプから派生していることに注意してください。また、この Financial Document は新しいコンテンツ タイプ Purchase Order および Invoice の親コンテンツ タイプです。最後の 2 つのコンテンツ タイプ両方の定義では、DisplayName 属性にカスタム値を割り当てられるように組み込みフィールド Title が参照されています。

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="https://schemas.microsoft.com/sharepoint/">

  <!-- Document Templates -->
  <Module Name="PurchaseOrderDocumentTemplate"
          Path="FinancialDocuments"
          Url="_cts/PurchaseOrder" RootWebOnly="TRUE">
    <File Url="PurchaseOrder.docx" Type="Ghostable" />
  </Module>

  <Module Name="InvoiceDocumentTemplate"
          Path="FinancialDocuments"
          Url="_cts/Invoice" RootWebOnly="TRUE">
    <File Url="Invoice.docx" Type="Ghostable" />
  </Module>

  <!-- Site Columns -->
  <Field ID="{060E50AC-E9C1-4D3C-B1F9-DE0BCAC300F6}"
         Name="Amount"
         DisplayName="Amount"
         Type="Currency"
         Decimals="2"
         Min="0"
         Required="FALSE"
         Group="Financial Columns" />

  <Field ID="{86811853-7E52-4515-A88D-A8FA9D450905}"
         Name="Client"
         DisplayName="Client Name"
         Type="Text"
         Required="FALSE"
         Group="Financial Columns"/>

  <Field ID="{943E7530-5E2B-4C02-8259-CCD93A9ECB18}"
         Name="CostCenter"
         DisplayName="Department"
         Type="Choice"
         Required="FALSE"
         Group="Financial Columns">
    <CHOICES>
      <CHOICE>Administration</CHOICE>
      <CHOICE>Information</CHOICE>
      <CHOICE>Facilities</CHOICE>
      <CHOICE>Operations</CHOICE>
      <CHOICE>Sales</CHOICE>
      <CHOICE>Marketing</CHOICE>
    </CHOICES>
  </Field>

  <Field ID="{1511BF28-A787-4061-B2E1-71F64CC93FD5}"
        Name="OrderDate"
        DisplayName="Order Date"
        Type="DateTime"
        Format="DateOnly"
        Group="Financial Columns">
    <Default>[today]</Default>
  </Field>

  <!-- Parent ContentType: Document (0x0101) -->
  <ContentType ID="0x0101000728167cd9c94899925ba69c4af6743e"
               Name="Financial Document"
               Group="Financial Content Types"
               Description="Base financial content type"
               Version="0">
    <FieldRefs>
      <FieldRef ID="{1511BF28-A787-4061-B2E1-71F64CC93FD5}" Name="OrderDate" DisplayName="Date" Required="FALSE"/>
      <FieldRef ID="{060E50AC-E9C1-4D3C-B1F9-DE0BCAC300F6}" Name="Amount" DisplayName="Amount" Required="FALSE"/>
    </FieldRefs>
  </ContentType>

  <!-- Parent ContentType: Financial Document -->
  <ContentType ID="0x0101000728167cd9c94899925ba69c4af6743e01"
               Name="PurchaseOrder"
               Group="Financial Content Types"
               Description="Used for creating purchase orders"
               Inherits="TRUE"
               Version="0">
    <FieldRefs>
      <!--  Built-in Title field -->
      <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" DisplayName="Item" Required="TRUE" Sealed="TRUE"/>
      <FieldRef ID="{943E7530-5E2B-4C02-8259-CCD93A9ECB18}" Name="CostCenter" DisplayName="Department" Required="TRUE"/>
    </FieldRefs>
    <DocumentTemplate TargetName="PurchaseOrder.docx"/>
  </ContentType>

  <!-- Parent ContentType: Financial Document -->
  <ContentType ID="0x0101000728167cd9c94899925ba69c4af6743e02"
                Name="Invoice"
                Group="Financial Content Types"
                Description="Used for creating customer invoices"
                Inherits="TRUE"
                Version="0">
    <FieldRefs>
      <!--  Built-in Title field -->
      <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" DisplayName="Service" Required="TRUE" Sealed="TRUE"/>
      <FieldRef ID="{86811853-7E52-4515-A88D-A8FA9D450905}" Name="Client" DisplayName="Client Name" Required="TRUE"/>
    </FieldRefs>
    <DocumentTemplate TargetName="Invoice.docx" />
  </ContentType>
</Elements>

関連項目

タスク

[方法] サイトにコンテンツ タイプを追加する

[方法] リストにコンテンツ タイプを追加する

概念

コンテンツ タイプについて

コンテンツ タイプの展開