Онлайн SharePoint: пользовательский тип контента не включен по умолчанию в определении списка

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

Вопрос

Требование: WebTemplate с пользовательскими библиотеками документов вместе с пользовательскими типами содержимого, которые будут использоваться в SharePoint 2013 онлайн

создал веб-шаблон и тип контента, оба работают нормально в онлайн-шарикопряте. Но я сталкиваюсь с двумя основными проблемами со списком определения

1) Невозможно включить пользовательский тип контента в качестве ContentTyPeref в схеме определения списка. 2) Невозможно выяснить, как включить определение списка на ONET.xml веб-шаблона, я пытаюсь добавить идентификатор функции, но при создании нового сайта с использованием шаблона библиотека документов отсутствует.

код:

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>
.

Может кто-нибудь предложить, что я делаю не так?

Несколько больше, все три вещи (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