删除工作项时,TFS聚合器更新父字段

时间:2017-12-12 15:28:20

标签: tfs azure-devops tfs-aggregator

当我对工作项进行一些更改时,我使用VSTS和tfs aggregator来更新父字段,并且每个工作都正常。现在我想在删除工作项时更新父字段。我收到错误:

    Exception encountered processing notification: TF26198: 
The work item does not exist, or you do not have permission to access it. 
Stack Trace:   
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.LoadWorkItemFromRowSetInternal(Int32 rev, Nullable`1 asof, IWorkItemRowSets witem)
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem..ctor(WorkItemStore store, Int32 id)
at Aggregator.Core.Facade.WorkItemRepository.GetWorkItem(Int32 workItemId)
at Aggregator.Core.EventProcessor.ProcessEvent(IRequestContext requestContext, INotification notification)
at Aggregator.WebHooks.Controllers.WorkItemController.Post(JObject payload)

当我删除workItem时,没有工作项可以通过它访问父项,但有没有办法让删除的workItem的父项?任何想法?

2 个答案:

答案 0 :(得分:2)

对此没有简单的答案。

我们在某些时候添加了对已删除事件的支持,但是在TFS将工作项标记为已删除后,聚合器会收到该事件。我们使用的API过滤掉那些对象IIRC。您拥有的唯一有用信息是已删除工作项的ID。使用PreviousRevision你可以回到过去,但我还没有尝试过。

提供源代码,欢迎PR。

答案 1 :(得分:1)

<强>更新 你不能这样做。

错误非常明确:

  

工作项不存在,或者您无权访问   它

当您通过命令删除工作项时,所有信息也将被删除。这会从数据存储中永久删除工作项。 永久删除意味着WIT数据存储中的所有信息都将被删除,无法恢复或重新激活。您绝对无法查询和更新已删除的工作项的父级。

即使工作项存在“某处”,您也无权打开工作项,也无法查询有关它的信息。它有点鸡肉/鸡蛋。看看这个类似的问题:TFS API: How to check if a work item has been deleted or is non existent on the TFS Server? (not if it is accessible)