我已经有团队项目(TFS 2018)我想知道使用了哪个流程模板

时间:2018-09-17 05:06:14

标签: tfs

我有一个现有的团队项目(TFS 2018)我想知道使用了哪个流程模板。

2 个答案:

答案 0 :(得分:0)

如果您使用3种内置模板(敏捷,Scrum,CMMI)中的1种,则可以检查您拥有的工作项类型:

  • 敏捷-用户故事
  • Scrum-产品待办事项
  • CMMI-要求

如果您使用自定义模板,则可以使用rest API检查流程模板:

Get http://yourServer:8080/tfs/DefaultCollection/_apis/projects/TestTemplate?includeCapabilities=true&api-version=1.0

您可以得到有关模板的结果,如下所示:

"capabilities": {
"processTemplate": {
  "templateName": "Test"
},

答案 1 :(得分:0)

  1. 通过REST API列出项目,并获得{projectId} 特定项目:

    GET http://SERVER:8080/tfs/DefaultCollection/_apis/projects
    
  2. 从项目中检索过程模板信息 通过调用REST API设置属性:

    GET http://SERVER:8080/tfs/DefaultCollection/_apis/projects/{projectId}/properties
    

    有关详细信息,请参见Projects - Get Project Properties

好吧,您只需使用下面的Powershell脚本即可获取用于特定团队项目的流程模板:

Param(
   [string]$collectionurl = "http://server:8080/tfs/DefaultCollection",
   [string]$projectname = "GXJGitTest",
   [string]$user = "domain\user",
   [string]$token = "password/PAT"
)

# Base64-encodes the Personal Access Token (PAT) appropriately
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))

#Get project ID
$ProjectsUrl = "$collectionurl/_apis/projects"          
$ProjectsResponse = Invoke-RestMethod -Uri $ProjectsUrl -Method Get -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}
$projectid = ($ProjectsResponse.value | where {$_.name -eq $projectname}).id

#Get system.template  
$PTurl = "$collectionurl/_apis/projects/$projectid/properties"      
$response = Invoke-RestMethod -Uri $PTurl -Method Get -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}
$ProcressTemplate = ($response.value | where {$_.name -eq 'System.Process Template'}).value 

Clear-host
Write-Host "The project $projectname is using the $ProcressTemplate Process Template."

enter image description here