我已经定义了一个内容类型“相关链接”并设置了Inherits =“False”并添加了一行以删除开箱即用的“标题”字段因为我不希望它在视图或新/编辑/显示形式中显示,请参阅下面CAML中的(选项1)。内容类型列表中不显示字段Inherits =“False”
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- ===== Fields ===== -->
<!-- Link Category -->
<Field DisplayName="Link Category"
Name="LinkCategory"
ID="{654EAC00-342B-4176-9D91-613AD724F684}"
Group="Custom"
Overwrite="True"
Type="Lookup"
ShowField="Title"
List="Lists/LinkCategoryList"
WebId="~sitecollection" />
<!-- ===== Content Type ===== -->
<!--
Related Links
- Parent ContentType: Item (0x01)
-->
<ContentType Name="Related Links"
ID="0x0100c11a1db14e564574bc49a2aa9bf325d3"
Group="Custom"
Description=""
Inherits="False"
Version="0">
<FieldRefs>
<!-- Title (OPTION 1) -->
<RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" />
<!-- (OPTION 2)
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"
Hidden="TRUE" Required="FALSE" DisplayName="_hidden" />
-->
<!-- Link Category -->
<FieldRef DisplayName="Link Category"
Name="LinkCategory"
ID="{654EAC00-342B-4176-9D91-613AD724F684}"
Required="True" />
</FieldRefs>
</ContentType>
</Elements>
这并从内容类型中删除“标题”字段,但是当我试图将内容类型与列表关联不视图或新建/编辑/显示形式显示“LinkCategory”字段。为什么这样?
<?xml version="1.0" encoding="utf-8"?>
<List xmlns:ows="Microsoft SharePoint"
Title="Related Links"
FolderCreation="FALSE"
Direction="$Resources:Direction;"
Url="Lists/RelatedLinksListDefinition"
BaseType="0"
EnableContentTypes="True"
xmlns="http://schemas.microsoft.com/sharepoint/">
<MetaData>
<ContentTypes>
<!-- Related Links -->
<ContentTypeRef ID="0x0100c11a1db14e564574bc49a2aa9bf325d3" />
</ContentTypes>
<Fields>
</Fields>
<Views>
<View ...etc...>
<ViewFields>
<FieldRef Name="LinkCategory"></FieldRef>
</ViewFields>
<Query>
<OrderBy>
<FieldRef Name="ID"></FieldRef>
</OrderBy>
</Query>
</View>
</Views>
<Forms>
<Form Type="DisplayForm" Url="DispForm.aspx"
SetupPath="pages\form.aspx" WebPartZoneID="Main" />
<Form Type="EditForm" Url="EditForm.aspx"
SetupPath="pages\form.aspx" WebPartZoneID="Main" />
<Form Type="NewForm" Url="NewForm.aspx"
SetupPath="pages\form.aspx" WebPartZoneID="Main" />
</Forms>
</MetaData>
</List>
由于各地我已经在内容类型设置继承=“真”,并在内容类型CAML使用(OPTION 2)和隐藏的“标题”字段,但真的想了解什么是工作去这里,最好的方法是什么。提前致谢!
PS:这篇文章有类似的问题:SharePoint 2010: RemoveFieldRef and Inherits="TRUE"
PSS:当我通过SP经理2010浏览使用选项1部署后,我得到如下:
- '链接类别' 字段正确创建
- “相关链接”与“连接类别”字段正确创建内容类型
- “相关链接”列表与“相关链接”相关的内容类型创建
- 但是“相关链接”列表没有提及“链接类别”字段。
将此问题标记为答案!非常感谢! – HW90 2012-05-30 06:27:24