Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Query for Changesets in TFS Web interface

Tags:

tfs

changeset

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?

like image 819
zeeple Avatar asked Sep 28 '17 18:09

zeeple


People also ask

How do you find changesets in TFS?

Find a changeset by IDIn Source Control Explorer, press Ctrl + G. The Go to Changeset dialog box appears. Type the number of the changeset and choose OK. If you don't know the number, choose Find.

How do I show changeset in Visual Studio?

you can go to the Source Control Explorer in Visual Studio and right-click on your project and select View History . This will show you the list of all changesets made to that project, who made them, the date they were made and any comment added to those changesets.

How do I download changeset from TFS?

Just copy and paste url inside your browser and you are done. If you have not previously authenticated with your TFS or VSO you will be prompted for credentials, then the file is downloaded.


2 Answers

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?

like image 161
Tomhans.J Avatar answered Oct 12 '22 09:10

Tomhans.J


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`
like image 24
Andy Li-MSFT Avatar answered Oct 12 '22 10:10

Andy Li-MSFT