【问题标题】:SharePoint content type : deleting columns from the parentSharePoint 内容类型:从父项中删除列
【发布时间】:2010-12-01 12:34:39
【问题描述】:

我正在尝试创建一个从联系人内容类型(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>

【问题讨论】:

    标签: sharepoint wss-3.0


    【解决方案1】:

    在您的内容类型定义中使用此语法:

    <FieldRefs>
          <RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name ="Title"  />
    </FieldRefs>
    

    您必须为要删除的每个文件找到正确的 ID。

    【讨论】:

      【解决方案2】:

      只需通过设置 HIDDEN="TRUE" 属性将它们隐藏在子内容类型中。 有关属性的完整列表,请参阅 here

      【讨论】:

      • 谢谢,非常有用的属性列表。
      【解决方案3】:

      如果您不需要这些字段,那么为什么要从该内容类型继承?

      【讨论】:

      • 我需要一些字段,但不是全部。我从 Contact 联系人类型继承,其中包含我想要删除的“Phonetic First Name”和“Phonetic Last Name”字段......其余字段都可以。
      【解决方案4】:

      我建议你重新考虑你的内容类型继承结构。定义一个父 ct,其中包含两个子 ct 共享的列,并将其他列添加到相应的子 ct。

      将其视为 OO 编程,您不会将仅在从类 A 继承的子类 B 中使用的方法放到父类 A 中,并在此过程中使该方法在从 A 继承的所有类中可用,而它们永远不会在那里使用,或者更糟糕的是,被滥用......

      【讨论】:

        猜你喜欢
        • 2010-11-12
        • 2011-09-08
        • 2011-04-16
        • 2011-09-19
        • 1970-01-01
        • 1970-01-01
        • 2013-03-08
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多