gpt4 book ai didi

sharepoint-2010 - SharePoint 2010 : RemoveFieldRef and Inherits ="TRUE"

转载 作者:行者123 更新时间:2023-12-04 07:16:11 25 4
gpt4 key购买 nike

我创建了一个从 OOTB SharePoint 继承的自定义内容类型 图片内容类型。我所做的唯一自定义是添加一个简单的 URL 字段,并删除基本类型上的两个字段。见下文:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Picture (0x010102) -->
<ContentType ID="0x0101020027f16ab27e6e45a6848c25c47aaa7053"
Name="Custom Picture"
Description=""
Group="Custom"
Inherits="TRUE"
Version="0">
<FieldRefs>
<RemoveFieldRef ID="{b66e9b50-a28e-469b-b1a0-af0e45486874}" Name="Keywords" />
<RemoveFieldRef ID="{a5d2f824-bc53-422e-87fd-765939d863a5}" Name="ImageCreateDate" />
<FieldRef ID="{c29e077d-f466-4d8e-8bbe-72b66c5f205c}" Name="URL" DisplayName="URL" Required="FALSE" />
</FieldRefs>
</ContentType>
</Elements>

如果我根据我的自定义内容类型创建一个图片库,我添加的“URL”字段会出现在新/编辑表单中,但是我尝试删除的两个字段也会显示,即 RemoveFieldRef 被忽略 .如果我查看“站点设置 -> 内容类型库”中的内容类型,这两个字段仍然列在那里。

设置 继承=“假”在我的自定义内容类型 ( see MSDN definition ) 上成功删除 就这两个 “站点设置 -> 内容类型库”页面中的字段,然后 的基本字段显示在新的/编辑表单中——只有我的自定义“URL”字段。

除了我专门删除的两个字段外,我该怎么做才能确保基本“图片”内容类型的所有字段都显示在我的图片库的新/编辑表单上?

最佳答案

我相信这个问题的本质是对内容类型继承如何工作的理解。
来自 MSDN ( http://msdn.microsoft.com/en-us/library/aa544268.aspx )

If Inherits is TRUE, the child content type inherits all fields that are in the parent, >including fields that users have added.

If Inherits is FALSE or absent and the parent content type is a built-in type, the child >content type inherits only the fields that were in the parent content type when >SharePoint Foundation was installed. The child content type does not have any fields that >users have added to the parent content type.

If Inherits is FALSE or absent and the parent content type was provisioned by a sandboxed >solution, the child does not inherit any fields from the parent.


我认为上面的关键短语是“如果 Inherits 为 TRUE,则子内容类型继承父项中的所有字段,包括用户添加的字段。”
这意味着,为了完成您打算做的事情,您将继承设置为 false,并且您必须为您希望在内容类型中使用的所有字段包含 FieldRef 元素。
您不引用/不包含有关如何将内容类型添加到列表实例的代码。确保这已更新以支持删除或将继承设置为 false。
这些站点支持此处描述的内容。
  • http://kvdlinden.blogspot.com/2011/06/issues-with-removefieldref-and.html
  • http://nelsonlamprecht.wordpress.com/2010/08/25/sharepoint-2010-removefieldref-and-inherits%E2%80%9Dtrue%E2%80%9D/
  • 关于sharepoint-2010 - SharePoint 2010 : RemoveFieldRef and Inherits ="TRUE",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5090383/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com