简体   繁体   English

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

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

I have a work item of type feature with a state of "Removed."我有一个类型为“已删除”的 state 特征的工作项。 When trying to update the field state back to "Active" on certain conditions, I'm getting the following error:在某些情况下尝试将字段 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

Note that my code works updating field.'System.State' in all cases except when it's trying to change a "removed" work item.请注意,我的代码在所有情况下都可以更新 field.'System.State' ,除非它试图更改“已删除”的工作项。 Is there a special way to do this?有没有特殊的方法可以做到这一点?

Is there a special way to do this?有没有特殊的方法可以做到这一点?

I am afraid there is no such way to do this.恐怕没有这样的方法可以做到这一点。

That is because the workitem that is already in the Removed state cannot be converted to other states except New .那是因为已经在Removed state 中的工作项无法转换为除New之外的其他状态。

You could check the document Agile workflow states for some more details.您可以查看文档敏捷工作流状态以获取更多详细信息。

在此处输入图像描述

In addition, when we have chosen to Remove a certain workitem, it means that we have abandoned the workitem.另外,当我们选择Remove某个工作项时,就意味着我们已经放弃了该工作项。 If the workitem is re-enabled, it should return to the state of New .如果工作项被重新启用,它应该返回到New的 state。

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

相关问题 如何使用 Azure DevOps API 将工作项与测试结果相关联? - How to associate a work item with a test result using the Azure DevOps API? azure-devops python 运行“create_work_item”时出错 - azure-devops python error running 'create_work_item' 如何更改 Azure DevOps 工作项中工作项的日期格式 - How to change the date format on a Work Item in Azure DevOps Work item 如何不在 azure devops 中的“创建工作项”任务中创建重复项 - How not to create duplicates in a task "Create work item" in azure devops Azure Devops 构建管道:当 PR 没有附加任何工作项时,CI 触发器无法在 PR 合并到分支 - Azure Devops build pipeline: CI triggers not working on PR merge to a branch when there is no work item is attached with the PR Azure Devops 查询以查找每天花在工作项目上的时间 - Azure Devops Query to find Daily hours spent on Work item Azure 运维专区 API - Azure Devops Area API Azure 开发运营 API 认证 - Azure DevOps API Authentication Azure Function OpenAPI - 已添加错误相同的密钥 - Azure Function OpenAPI - Error same key has already been added 通过JavaScript获取Azure DevOps所有已合并到分支的工作项 - Obtain all work items from Azure DevOps that have been merged into a branch via JavaScript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM