有没有更好的方法来导出 Azure DevOps 项目的模板(字段和状态)?
Is there a nicer way to export Azure DevOps project's Templates (fields and states)?
我对整个集合使用 'witadmin listfields' 命令,但想知道我是否可以将 fields/states 扩展到单个项目?
背后的原因:有时我将 TFS 项目迁移到 AzureDevOps 现有项目。收集有关字段的数据需要大量的手动工作。想知道这个过程的自动化...
非常感谢!
您可以查看其余 api 以获取项目的 fields/states。见下文:
GET https://{instance}/{collection}/{project}/_apis/wit/workitemtypes/{type}/fields?api-version=4.1
GET https://{instance}/{collection}/{project}/_apis/wit/workitemtypes/{type}/states?api-version=4.1-preview.1
对于下面的示例,在 powershell 脚本中调用上面的 rest apis:
[string]$userName = 'domain\username'
[string]$userPassword = 'password'
# Convert to SecureString
[securestring]$secStringPassword = ConvertTo-SecureString $userPassword -AsPlainText -Force
[pscredential]$credOject = New-Object System.Management.Automation.PSCredential ($userName, $secStringPassword)
$uri = "http://{instance}/{collection}/{project}/_apis/wit/workitemtypes/Bug/fields?api-version=4.1"
$invRestMethParams = @{
Credential = $credOject
Uri = $uri
Method = 'Get'
ContentType = 'application/json'
}
Invoke-RestMethod @invRestMethParams
我对整个集合使用 'witadmin listfields' 命令,但想知道我是否可以将 fields/states 扩展到单个项目?
背后的原因:有时我将 TFS 项目迁移到 AzureDevOps 现有项目。收集有关字段的数据需要大量的手动工作。想知道这个过程的自动化...
非常感谢!
您可以查看其余 api 以获取项目的 fields/states。见下文:
GET https://{instance}/{collection}/{project}/_apis/wit/workitemtypes/{type}/fields?api-version=4.1
GET https://{instance}/{collection}/{project}/_apis/wit/workitemtypes/{type}/states?api-version=4.1-preview.1
对于下面的示例,在 powershell 脚本中调用上面的 rest apis:
[string]$userName = 'domain\username'
[string]$userPassword = 'password'
# Convert to SecureString
[securestring]$secStringPassword = ConvertTo-SecureString $userPassword -AsPlainText -Force
[pscredential]$credOject = New-Object System.Management.Automation.PSCredential ($userName, $secStringPassword)
$uri = "http://{instance}/{collection}/{project}/_apis/wit/workitemtypes/Bug/fields?api-version=4.1"
$invRestMethParams = @{
Credential = $credOject
Uri = $uri
Method = 'Get'
ContentType = 'application/json'
}
Invoke-RestMethod @invRestMethParams