我正在使用第三方供应商的沙箱解决方案,其中包含一些站点列和站点内容类型。
我想将此内容类型添加到CAML中的文档库定义。
但是当我在 schema.xml中添加对此内容类型的引用时:

<List ... EnableContentTypes="TRUE">
 <MetaData>
  <ContentTypes>
   <ContentTypeRef ID="0x0101002EFF4F6709F446E5AD064DC20BBE6855" />
   <!--contenttypeid of content type from sandboxed solution-->
   <ContentTypeRef ID="0x0101" />
   <!--contenttypeid of Document-->
   ...
  </ContentTypes>
  ...
 </MetaData>
</List>
.

当我创建它的实例时,未添加到我的库中的内容类型。 (当然,在沙盒解决方案被激活后创建了这个文档库)
更糟糕的事实情况下,我收到以下错误消息:

找到重复的内容类型名称“文档”。

我有理由相信这是因为SP以某种方式找不到沙盒内容类型并认为它是一个孩子内容类型的文件。因此,它将文档内容类型两次添加到我的列表中,并具有此错误消息。

我只是不明白为什么它不是从沙箱解决方案添加内容类型?
毕竟我可以在网站(集合)内容类型库中看到此内容类型,我能够通过UI将内容类型添加到同一文档库,而不引用此“沙盒”内容类型。

更新:我试图只添加第三方供应商的内容类型到文档库定义,现在只添加1个“文档”内容类型。

实际上它创建一个名为“文档”的列表内容类型,它从第三方供应商的站点内容类型继承。
因此,将显示以下列表内容类型信息:

  • 名称:文档
  • 描述:创建新文档
  • 父级:{3派对供应商的网站内容类型}

    和站点内容类型的站点列被复制。
    不幸的是,它不会更新列表内容类型的名称。

    请分享您可能有的任何线索...

有帮助吗?

解决方案

It seems that list has its own internal content type or at the very least, its own set of fields, which is creating the problem. Try investigating the list with the SharePoint Manager 2007/2010.

The alternative approach could be to use ContentTypeBinding element to bind multiple ContentTypes.

<ContentTypeBinding 
      ContentTypeId="0x010100AA8705BBBC554342BC1396AB7FB723B401" 
      ListUrl="MyDocLibrary"  
/> 
<ContentTypeBinding 
      ContentTypeId="0x010100AA8705BBBC554342BC1396AB7FB723B402" 
      ListUrl="MyDocLibrary" 
/> 
<ContentTypeBinding 
      ContentTypeId="0x010100AA8705BBBC554342BC1396AB7FB723B403" 
      ListUrl="MyDocLibrary" 
 /> 

ContentTypeBinding elements that are responsible for linking the multiple content types share a common parent i.e. 0x0101, which means ancestor of this type is the base Document content type.

许可以下: CC-BY-SA归因
scroll top