Search code examples
visual-studiotfscommentschangeset

visual studio 2017 search tfs changeset comment


I would like to search for tfs changeset comment in visual studio 2017. Any way or tools except "View history and copy all to excel and search"?

Thanks.


Solution

  • Try below PowerShell script, just replace the search text 07 as your own behind like '*07*'

    $baseUrl = "http://server:8080/tfs/DefaultCollection/_apis/tfvc/changesets?maxCommentLength=30&api-version=1.0"         
    $changesets = (Invoke-RestMethod -Uri $baseUrl -Method Get -UseDefaultCredential).value|where({$_.comment -like '*07*'})
    
    $changesetResults = @()
    
    foreach($changeset in $changesets){
    
        $customObject = new-object PSObject -property @{
              "changesetId" = $changeset.changesetId
              "author" = $changeset.author.uniqueName
              "checkedInBy" = $changeset.checkedInBy.uniqueName
              "createdDate" = $changeset.createdDate
              "comment" = $changeset.comment
            } 
    
        $changesetResults += $customObject      
    }
    
    $changesetResults | Select `
                    changesetId, 
                    author, 
                    checkedInBy,
                    createdDate,
                    comment #|export-csv -Path C:\Changesets.csv -NoTypeInformation
    

    enter image description here


    If you are using VS client, you can also use below extensions to search with comments: