Reputation: 85
I have existing team project ( TFS 2018 )I want to know which process template have been used.
Upvotes: 0
Views: 1011
Reputation: 30372
List the projects via REST API and get the {projectId}
for
a specific project:
GET http://SERVER:8080/tfs/DefaultCollection/_apis/projects
Retrieve the Process template information from project properties by calling REST API:
GET http://SERVER:8080/tfs/DefaultCollection/_apis/projects/{projectId}/properties
Please see Projects - Get Project Properties for details.
Well, you can simply use below Powershell script to get which process template have been used for a specific team project:
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."
Upvotes: 1
Reputation: 41565
If you use 1 from 3 built-in templates (Agile, Scrum, CMMI) you can check which work item type you have:
If you use a custom template you can check the process template with rest API:
Get http://yourServer:8080/tfs/DefaultCollection/_apis/projects/TestTemplate?includeCapabilities=true&api-version=1.0
You could get the result about the template like the following:
"capabilities": {
"processTemplate": {
"templateName": "Test"
},
Upvotes: 0