SharePoint 内容类型:从父级删除列
我正在尝试创建一个将从“联系人”内容类型(SharePoint 附带的)继承的内容类型。 我需要其中的大部分字段,但希望能够删除其中一些字段。
有没有办法通过内容类型的 XML 定义删除我不需要的字段?
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType ID="0x01004B56BB872BFE984D9611B5D8CF52CB60" Name="Child Contact" Description="Inherits from Contact" Group="...">
<FieldRefs>
??? What would I put there to remove fields that exist in the parent?
</FieldRefs>
</ContentType>
</Elements>
I'm trying to create a content type that will inherit from the Contact content type (that comes with SharePoint).
I need most of the fields in there but would like to be able to remove some of them.
Is there a way I can remove the fields I don't want through the XML definition of the Content Type?
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType ID="0x01004B56BB872BFE984D9611B5D8CF52CB60" Name="Child Contact" Description="Inherits from Contact" Group="...">
<FieldRefs>
??? What would I put there to remove fields that exist in the parent?
</FieldRefs>
</ContentType>
</Elements>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在内容类型定义中使用以下语法:
您必须为要删除的每个字段找到正确的 ID。
Use this syntax in your content type definition:
You must find proper ID for each filed you want to remove.
只需通过设置 HIDDEN="TRUE" 属性将它们隐藏在子内容类型中即可。
有关属性的完整列表,请参阅此处。
Just hide them in child content type by setting HIDDEN="TRUE" attribute.
See here for full list of attributes.
如果您不需要这些字段,那么为什么首先要从该内容类型继承呢?
If you don't need those fields then why are you inheriting from that content type in the first place?
我建议您重新考虑您的内容类型继承结构。定义一个仅包含两个子 ct 共享的列的父 ct,并将其他列添加到相应的子 ct。
将其视为 OO 编程,您不会将仅在从类 A 继承的子类 B 中使用的方法放入父类 A 中,并在此过程中使该方法在从 A 继承的所有类中可用,而它们永远不会在那里使用,或者更糟糕的是,被滥用......
I suggest you rethink your content type inheritance structure then. Define a parent ct that contains JUST the columns shared by both child ct's, and add the other columns to the respective child ct.
Think of it as OO programming, you would not put methods that are used ONLY in subclass B that inherits from class A TO that parent class A, and in the process make that method available in all classes inheriting from A, while they will never be used there, or even worse, be misused...