Neeva
Neeva

Reputation:

How to determine used process template in Team Foundation Server after creation of team project

I'm looking for a way to determine what process template was used for a team project after it has been created. I can now only guess by looking at the work item types. I could not find any option in Visual Studio to retrieve this information. I need to know what processs template was used for team projects not created by myself.

Upvotes: 24

Views: 20718

Answers (8)

AndyS
AndyS

Reputation: 820

PowerShell & REST API

Here's a PowerShell script to get the list of Projects and their Process templates from an on-prem DevOps Server (works on Server 2022).

It will display the projects in the console and also save the results to a txt or csv file.

# Run this PowerShell script on your DevOps Server (on prem) from an account with DevOps admin access
# Update $collectionUrl below

$collectionUrl = "https://MyDevopsServer/MyCollection/"

# API REST call to get the list of projects in the collection
$projects = Invoke-RestMethod -Uri "$collectionUrl/_apis/projects" -Method Get -UseDefaultCredentials -ContentType application/json    

Write-Host "Src Ctrl  ProcTemplate  Project"
Write-Host "--------  ------------  -------"

# Loop through each project and save properties to $Output
$Output = foreach($project in $projects.value | Sort-Object name)
{
    $teamProject = $project.name;
    $projectInfoUrl = $project.url + "?includeCapabilities=true";
    
    # API REST call to get the project's capabilities
    $projectInfo = Invoke-RestMethod -Uri "$projectInfoUrl" -Method Get -UseDefaultCredentials -ContentType application/json

    $sourceControlType = $projectInfo.capabilities.versioncontrol.sourceControlType;
    $templateName = if ($projectInfo.capabilities.processTemplate.templateName) {$projectInfo.capabilities.processTemplate.templateName} else {'  '};

    Write-Host $sourceControlType `t`t $templateName `t`t $teamProject
    
    # Create an object to save properties and append to $Output
    New-Object -TypeName PSObject -Property @{
        TeamProject = $teamProject
        SourceControlType = $sourceControlType
        TemplateName = $templateName 
    } | Select-Object TeamProject,SourceControlType,TemplateName
}

#Write to CSV or TXT file
$txtFile = $PSScriptRoot + "\ProjectList.txt"
$csvFile = $PSScriptRoot + "\ProjectList.csv"
$Output | Out-File $txtFile
#$Output | Export-Csv $csvFile

You can also call the REST methods manually from Postman/curl:

  • Projects: GET https://MyDevopsServer/MyCollection/_apis/projects
  • Project details: GET https://MyDevopsServer/MyCollection/_apis/projects//<<ProjectGuid>>?includeCapabilities=true

Make sure to add an authorization header of type Basic Auth with blank username and a valid PAT token in the password.

Upvotes: 0

Krisna Dharma
Krisna Dharma

Reputation: 61

For visual studio online, go to your collection profile page. You can see all the projects inside your collection including the process template information.

The URL format to your collection page should be: https://[accountname].visualstudio.com/[collectionname]/_admin

Upvotes: 1

Karl Gjertsen
Karl Gjertsen

Reputation: 4918

If you check your work item type:

  • Scrum = Product Backlog Item
  • Agile = User Story
  • CMMI = Requirement

Upvotes: 13

forrestg
forrestg

Reputation: 347

For TFS 2010 & TFS 2012, you can follow below process to determine which process template a team project used:

  1. Go to Team Explorer;
  2. Open Documents folder;
  3. Process Guidance;
  4. Open ProcessGuidance.html, this will open specific Process Template documenation that your team project base on.

Refer to thread

Upvotes: 7

Su Llewellyn
Su Llewellyn

Reputation: 11

Using witadmin, you can list the work item types in the project. The /collection parameter is the TPC url and the /p parameter is the project name. Here is an example (below). If you know the name of a work item type that is specific to a process template, then you know which process template is being used.

Output of command console from my test TFS:

D:\Program Files\Microsoft Team Foundation Server 2010\Tools>witadmin listwitd /collection:http://suluserver:8080/tfs/De
faultCollection /p:"First Team Project"
Bug
Shared Steps
Task
Test Case
User Story
Issue
Risk
User Scenario
Risk-Issue

Upvotes: 1

Eric Stob
Eric Stob

Reputation: 51

There is no way to tell, in general. If you create (or edit) a process template, you can put an identifier into a property then you will be able to track which projects have your template(s)

To do this: Edit Classification\Classification.xml add a node: tasks/task/taskXml/properties/property like this:

<property name="templateName" value="myTemplate_1.0.1" />

Once you have projects created with this template, in the object model you will be able to pull this info from a project:

TfsTeamProjectCollection c = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(myuri);
WorkItemStore wis = tpc.GetService();
ICommonStructureService ICss = tpc.GetService();

foreach (Project p in wis.Projects)
{
  string ProjectName = string.Empty;
  string ProjectState = String.Empty;
  int templateId = 0;
  ProjectProperty[] ProjectProperties = null;
  ICss.GetProjectProperties(p.Uri.ToString(), out ProjectName, out ProjectState, out templateId, out ProjectProperties);
  Console.WriteLine("Project: {0}\tTemplate: {1}", ProjectName, ProjectProperties.Where(n => n.Name == "templateName").FirstOrDefault().Value);
}

templateId is always -1 so dont think that will help you.

Also - If you have the rights to, I recommend adding this property into all the templates (even the default templates) in your collection, so that you will be able to track the templates of all future projects. Don't know why they didn't put it in the default templates. (if enough people complain maybe they will)

Upvotes: 5

Neeva
Neeva

Reputation:

I found another workaround: in SharePoint Central Administration you can see in the Site Collection list a comment that described the process template that was used. I was actually looking for a way to programatically retrieve it via the TFS API, but could not find it.

Upvotes: 2

Vaccano
Vaccano

Reputation: 82291

I don't know a fail proof way to find this out.

I would recommend the following: There is a exe called witexport.exe that can export the xml of a work item. You can then look through the xml to see what kind of template was used. (ie if the conchango template is used you will see references to it.)

To run it fire up the VS Command line prompt (in the start menu). Here is an example run:

witexport /f "C:\Type.xml" /t "http:\MyServer:8080" /p MyProject /n "Sprint BackLog Item"

Upvotes: 0

Related Questions