zeeple
zeeple

Reputation: 5607

How to Query for Changesets in TFS Web interface

In TFS web interface I can query for items with various link types:

enter image description here

However, Changesets, while they are a legitimate and distinct link type in TFS are not included in that list:

enter image description here

Using the web interface, how does one query for Work Items that either do, or do not include links of the type Changeset?

Upvotes: 6

Views: 7303

Answers (2)

Andy Li-MSFT
Andy Li-MSFT

Reputation: 30362

You can also use the REST API to query out the work items which associated with changes.

1- Do a Query and include External Link Count > 0 (This will give you the work item list with the external link which also including linked to the changesets.)

2- List the work item IDs and use below PowerShell script sample to filter the work items which associated to changesets. (You can also export the list to a .csv file)

$baseUrl = "http://server:8080/tfs/CollectionLC/_apis/wit/workitems?ids=75,76,77,78&"+"$"+"expand=relations&api-version=1.0"            
$workitems = (Invoke-RestMethod -Uri $baseUrl -Method Get -UseDefaultCredential).value|where({$_.relations.attributes.name -eq 'Fixed in Changeset'})

$WorkitemResults = @()

foreach($workitem in $workitems){

    $customObject = new-object PSObject -property @{
          "workitemId" = $workitem.id
          "workitemTitle" = $workitem.fields.'System.Title'
          "State" = $workitem.fields.'System.State'
          "CreatedBy" = $workitem.fields.'System.CreatedBy'
          "Project" = $workitem.fields.'System.TeamProject'
          "AssignedTo" = $workitem.fields.'System.AssignedTo'
        } 

    $workitemResults += $customObject       
}

$workitemResults | Select `
                workitemId, 
                workitemTitle, 
                Project,
                State,
                CreatedBy,
                AssignedTo #|export-csv -Path C:\WorkitemsWithChangesets.csv -NoTypeInformation`

Upvotes: 1

Tomhans.J
Tomhans.J

Reputation: 440

You are right. There is just not changeset LINKS field in default TFS Work Item Query Editor on web interface. Since if you do a Query and include external link count >0 this will actually give you all work items that have changesets associated with it.

Another way is using TFS API to achieve it. Suggest you use the way provided by Buck in this great blog: Listing the work items associated with changesets for a path

More ways please look at this similar question: How can I query work items and their linked changesets in TFS?

Upvotes: 4

Related Questions