SharePoint Online: Tipo di contenuto personalizzato non incluso per impostazione predefinita nella definizione dell'elenco

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

Domanda

Requisito: WebTemplate con librerie di documenti personalizzate insieme ai tipi di contenuti personalizzati da utilizzare in SharePoint 2013 online

Creato il modello Web e il tipo di contenuto, entrambi funzionano bene in SharePoint online. Ma sto affrontando due problemi principali con definizione dell'elenco

1) Impossibile includere il tipo di contenuto personalizzato come contenutoTeref in schema di definizione dell'elenco. 2) Impossibile capire come includere la definizione dell'elenco su Onet.xml del modello Web, sto cercando di aggiungere l'ID funzione a ma dopo aver creato un nuovo sito utilizzando il modello che manca la libreria dei documenti.

Codice:

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

Parte della definizione della lista 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>
.

All'interno dei contentTypes ho anche provato a utilizzare ContentTyperef ma questo non funziona

Elemento del tipo di contenuto.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>
.

Qualcuno può suggerire cosa sto facendo male?

Poche altre cose, tutte e tre le cose (webtemplate, tipo di contenuto e definizione dell'elenco) sono incluse nella stessa funzione che è ambientata sul sito, poiché la distribuirò su SharePoint online che è l'architettura di sandboxed.

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top