繁体   English   中英

Azure DevOps API 错误:字段 state 当工作项被“删除”时不支持“活动”

[英]Azure DevOps API error: Field state 'Active' not supported when Work Item has been "Removed"

我有一个类型为“已删除”的 state 特征的工作项。 在某些情况下尝试将字段 state 更新回“活动”时,出现以下错误:

resp = Invoke-RestMethod -Uri $updateUri -Method Patch -ContentType application/json-patch+json -Headers $header -Body $jsonBody
Invoke-RestMethod : {"$id":"1","customProperties":{"FieldReferenceName":null,"FieldStatusFlags":"none","ErrorMessage":"The field 'State' contains the value 'Active' that is not in 
the list of supported values","FieldStatusCode":0,"RuleValidationErrors":[{"fieldReferenceName":"System.State","fieldStatusFlags":"required, hasValues, limitedToValues, 
invalidListValue","errorMessage":"The field 'State' contains the value 'Active' that is not in the list of supported 
values","fieldStatusCode":4194317,"ruleValidationErrors":null}]},"innerException":null,"message":"The field 'State' contains the value 'Active' that is not in the list of supported 
values","typeName":"Microsoft.TeamFoundation.WorkItemTracking.Server.RuleValidationException, 
Microsoft.TeamFoundation.WorkItemTracking.Server","typeKey":"RuleValidationException","errorCode":0,"eventId":3200}
At line:1 char:9
+ $resp = Invoke-RestMethod -Uri $updateUri -Method Patch -ContentType  ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

请注意,我的代码在所有情况下都可以更新 field.'System.State' ,除非它试图更改“已删除”的工作项。 有没有特殊的方法可以做到这一点?

有没有特殊的方法可以做到这一点?

恐怕没有这样的方法可以做到这一点。

那是因为已经在Removed state 中的工作项无法转换为除New之外的其他状态。

您可以查看文档敏捷工作流状态以获取更多详细信息。

在此处输入图像描述

另外,当我们选择Remove某个工作项时,就意味着我们已经放弃了该工作项。 如果工作项被重新启用,它应该返回到New的 state。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM