在TFS中,如何使用API或命令行更改分配给任务的用户?
谢谢。
答案 0 :(得分:1)
您可以使用Work Items - Update Rest API更新任何工作项字段。
PowerShell示例:
$collectionUrl = "http://{tfs-url}:8080/tfs/{collection}"
$workItemId = "1"
$byPass = "true"
$url = "$collectionUrl/_apis/wit/workitems/$workItemId?bypassRules=$($byPass)&api-version=3.0"
#the "op : add" is also repleace existing value
$body = '[
{
"op":"add",
"path":"/fields/System.AssignedTo",
"value":"User Name"
}
]'
try
{
Invoke-RestMethod -Method Patch -UseDefaultCredentials -Uri $url -Body $body -ContentType application/json-patch+json
Write-Host "Change work item $workItemId" -ForegroundColor Green
}
catch
{
Write-Host $_ -ForegroundColor Red
}