オンラインSharePoint:リスト定義でデフォルトで含まれていないカスタムコンテンツタイプ

sharepoint.stackexchange https://sharepoint.stackexchange.com//questions/77765

質問

要件:カスタム文書ライブラリを持つWebTemplate SharePoint 2013 Online で使用するカスタムコンテンツタイプとともに

Webテンプレートとコンテンツの種類を作成し、両方ともオンラインSharePointでうまく機能しています。しかし、私はリスト定義の2つの主要な問題に直面しています

1)リスト定義スキーマ内のcontentTyperefとしてカスタムコンテンツタイプを含めることができません。 2)Webテンプレートのonet.xmlにリスト定義を含める方法を理解できない、私はフィーチャIDを追加しようとしていますが、新しいサイトを作成しようとしていますが、文書ライブラリが見つからないテンプレートがありません。

コード:

onet.xml

<?xml version="1.0" encoding="utf-8"?>
<Project Title="$Resources:onet_TeamWebSite;" Revision="3" ListDir="$Resources:core,lists_Folder;" xmlns:ows="Microsoft SharePoint" UIVersion="15" HideSiteContentsLink="true">
  <NavBars>
  </NavBars>
  <ListTemplates>
  </ListTemplates>
<Configurations>
    <Configuration ID="0" Name="Default" MasterUrl="_catalogs/masterpage/seattle.master">
      <Lists>
        <List FeatureId="00BFEA71-E717-4E80-AA17-D0C71B360101" Type="101" Title="$Resources:core,shareddocuments_Title_15;" Url="$Resources:core,shareddocuments_Folder;" OnQuickLaunch="TRUE" QuickLaunchHeading="TRUE" />
      </Lists>
      <SiteFeatures>
        <Feature ID="8b312a79-d117-44ef-81b2-453a71ccfea5" /> // Feature including the list definition
      </SiteFeatures>
      <WebFeatures>
      </WebFeatures>
    </Configuration>
  </Configurations>
  <ServerEmailFooter>$Resources:ServerEmailFooter;</ServerEmailFooter>
</Project>
.

リスト定義のschema.xml の一部

<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint" Title="Resources" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/Resources" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/" EnableContentTypes="TRUE">
  <MetaData>
    <ContentTypes>
      <ContentType ID="0x010100992CB78E42804317A18A5E40907EA235" Name="Custom Content Type" Group="Custom Content Type" Description="Custom Content Type" Inherits="TRUE" Version="0">
        <FieldRefs>
          <FieldRef ID="{796E4A07-6AD2-4AC4-8788-2536EA0B0224}" Name="Organization/Author" Required="TRUE" />
          <FieldRef ID="{782D2071-7531-4F34-92E2-2418090A3ED9}" Name="Publication Date" Required="TRUE" />
          <FieldRef ID="{ceee0e58-7e36-47c9-9e20-3d3d0d7ba0d4}" Name="Partners" Required="TRUE" />
        </FieldRefs>
      </ContentType>
    </ContentTypes>
    <Fields>
      </Fields>
    <Views>
.

ContentTypes内でもContentTypereFを使用してみましたが、機能していない

コンテンツタイプの要素xml

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

  <Field ID="{796E4A07-6AD2-4AC4-8788-2536EA0B0224}" Type="Text" Name="Organization/Author" DisplayName="Organization/Author" ShowInNewForm="FALSE" ShowInFileDlg="FALSE"></Field>
  <Field ID="{782D2071-7531-4F34-92E2-2418090A3ED9}" Type="DateTime" Name="Publication Date" DisplayName="Publication Date" Required="FALSE" EnforceUniqueValues="FALSE" ShowInNewForm="FALSE" ShowInFileDlg="FALSE"></Field>
  <Field ID="{ceee0e58-7e36-47c9-9e20-3d3d0d7ba0d4}" Type="Choice" Name="Partners" DisplayName="Partners" Required="FALSE" EnforceUniqueValues="FALSE" Indexed="FALSE" Format="Dropdown" FillInChoice="FALSE">  
    <CHOICES>
      <CHOICE>Yes</CHOICE>
      <CHOICE>No</CHOICE>
    </CHOICES>
  </Field>

  <!-- Parent ContentType: Document (0x0101) -->
  <ContentType ID="0x010100992CB78E42804317A18A5E40907EA235" Name="Custom Content Type" Group="Custom Content Type" Description="Custom Content Type" Inherits="TRUE" Version="0">
    <FieldRefs>
      <FieldRef ID="{796E4A07-6AD2-4AC4-8788-2536EA0B0224}" Name="Organization/Author" Required="TRUE" />
      <FieldRef ID="{782D2071-7531-4F34-92E2-2418090A3ED9}" Name="Publication Date" Required="TRUE" />
      <FieldRef ID="{ceee0e58-7e36-47c9-9e20-3d3d0d7ba0d4}" Name="Partners" Required="TRUE" />
    </FieldRefs>
  </ContentType>
</Elements>
.

誰かが私が間違っていることを提案することができますか?

もう少しのもの、3つのこと(WebTemplate、コンテンツタイプ、リスト定義)はすべてサイトにスコープされているのと同じ機能に含まれています。これは、サンドボックスアーキテクチャのSharePoint Onlineに展開します。

役に立ちましたか?

解決

I'd like to suggest you restructure your code a bit if I may. Put the web template in its own solution. Get that working first.

Then create a second solution that includes the content type and list. Its feature should be scoped to Web, not Site. I don't see any issues with your schema, and VS2012 in any case has a list designer wizard, and if you used that you should be OK.

The reason I am suggesting 2 solutions is because web templates complicate the development workflow. Redeploying it entails deleting and recreating the whole site. There's no need to do that if you're only working on the list. With your list in a separate solution your redeployments will go much quicker.

If you need everything in one solution you can put them back togather once everything is working, but you need to have two features: Your web template must be in a Site-scoped feature, and your list needs to be in a Web-scoped feature. The fields and content type, I think, might be OK in either scope but I've always made them Web scoped.

ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top