我正在尝试以编程方式将带有新时间轴的Tasklist添加到我的解决方案中。但是它似乎与我的ContentType不兼容。
ContentType继承自任务,但必须删除字段PercentComplete
,AssignedTo
和Priority
,并重命名DueDate和StartDate。我的内容类型如下所示:
<!--PercentComplete-->
<FieldRef ID="{d2311440-1ed6-46ea-b46d-daa643dc3886}" Hidden="TRUE" />
<!--AssignedTo-->
<FieldRef ID="{53101f38-dd2e-458c-b245-0c236cc13d1a}" Hidden="TRUE" />
<!--PreviouslyAssignedTo-->
<FieldRef ID="{1982e408-0f94-4149-8349-16f301d89134}" Hidden="TRUE"/>
<!--Priority-->
<FieldRef ID="{a8eb573e-9e11-481a-a8c9-1104a54b2fbd}" Hidden="TRUE" />
<!--Title-->
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Required="TRUE" />
<!--LinkTitle-->
<FieldRef ID="{82642ec8-ef9b-478f-acf9-31f7d45fbc31}" />
<!--LinkTitleNoMenu-->
<FieldRef ID="{bc91a437-52e7-49e1-8c4e-4698904b2b6d}" />
<!--DueDate-->
<FieldRef ID="{cd21b4c2-6841-4f9e-a23a-738a65f99889}" DisplayName="End of Task" Required="TRUE" />
<!--StartDate-->
<FieldRef ID="{64cd368d-2f95-4bfc-a1f9-8d4324ecb007}" DisplayName="Start of Task" Required="TRUE" />
<!--Checkmark-->
<FieldRef ID="{ebf1c037-47eb-4355-998d-47ce9f2cc047}" />
<!--Body-->
<FieldRef ID="{7662cd2c-f069-4dba-9e35-082cf976e170}" />
<!--Predecessors-->
<FieldRef ID="{c3a92d97-2b77-4a25-9698-3ab54874bc6f}" />
<!--RelatedItems-->
<FieldRef ID="{d2a04afc-9a05-48c8-a7fa-fa98f9496141}" />
<!--Status-->
<FieldRef ID="{c15b34c3-ce7d-490a-b133-3f4de8801b76}" />
<!--ParentID-->
<RemoveFieldRef ID="{fd447db5-3908-4b47-8f8c-a5895ed0aa6a}" />
由于隐藏的AssignedTo,PrelyAssignedTo被隐藏。 如果我不删除ParentID,功能将不会激活(抛出错误)! Anywho,删除该字段将激活,但List会抛出错误。我很困惑。
List是一个简单的Tasklist,上面添加了contenttype(删除了标准任务),Tasklist的类型设置为171。我使用Visual Studio向导添加了List并使用向导更改了内容类型,然后转到xml并更改了类型。
这是错误讯息:
HierarchyParentKeyColumnName
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: HierarchyParentKeyColumnName
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: HierarchyParentKeyColumnName]
Microsoft.SharePoint.JSGrid.GridSerializer.EnableReservedHierarchy() +35354306
Microsoft.SharePoint.JSGrid.SPGridSerializerGenerator.GenerateGridSerializer() +718
Microsoft.SharePoint.JSGrid.SPGridSerializerGenerator.CreateGridSerializer() +257
Microsoft.SharePoint.WebPartPages.XsltListViewWebPart.EnsureJSonObject() +1265
Microsoft.SharePoint.WebPartPages.XsltListViewWebPart.OnPreRender(EventArgs e) +377
Microsoft.SharePoint.WebPartPages.WebPartMobileAdapter.OnPreRender(EventArgs e) +108
System.Web.UI.Control.PreRenderRecursiveInternal() +12756035
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Control.PreRenderRecursiveInternal() +222
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4297
如果您需要更多信息,请发表评论。非常感谢帮助。
答案 0 :(得分:0)
通过简单地为stackoverflow制定你的问题来排序你的想法总是有帮助;)我试图用你的ParentID解决错误,以便你可以专注于真正的问题。事实证明,ParentID是真正的问题。
我添加了Lookup目标:
<!--ID-->
<FieldRef ID="{1d22ea11-1e32-424e-89ab-9fedbadb6ce1}" />
<!--ParentID-->
<FieldRef ID="{fd447db5-3908-4b47-8f8c-a5895ed0aa6a}" />
而且(更重要的是)改变了&#34; self&#34; parent contentTypes(任务)查找字段定义到实际列表实例。
<Field Type="Lookup"
Indexed="TRUE"
Name="ParentID"
ID="{fd447db5-3908-4b47-8f8c-a5895ed0aa6a}"
Hidden="TRUE"
Required="FALSE"
List="$Resources:core,lists_Folder;MyTaskList" RelationshipDeleteBehavior="Cascade"
ShowField="ID" DisplayName="$Resources:core,Parent_ID;" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ParentID"></Field>