$dllPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer" Add-Type -Path "$dllPath\Microsoft.TeamFoundation.Client.dll" Add-Type -Path "$dllPath\Microsoft.TeamFoundation.WorkItemTracking.Client.dll" Add-Type -Path "$dllPath\Microsoft.TeamFoundation.VersionControl.Client.dll" # Connect to TFS $tfsUri = "https://tfs2.domain.net/tfs/project" $username = "DOMAIN1\user1" # or just "your-username" if no domain $password = "-password-here" # Create secure credentials $securePassword = ConvertTo-SecureString $password -AsPlainText -Force $credentials = New-Object System.Net.NetworkCredential($username, $securePassword) # Create TFS connection using credentials $uri = New-Object System.Uri($tfsUri) $tfs = New-Object Microsoft.TeamFoundation.Client.TfsTeamProjectCollection($uri, $credentials) $tfs = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollection]::new($tfsUri) $tfs.EnsureAuthenticated() # Get services $workItemStore = $tfs.GetService([Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore]) $versionControl = $tfs.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer]) # Get work item (replace with your Task ID) $workItem = $workItemStore.GetWorkItem(29574) $dict=@{} # Loop over links to find associated changesets foreach ($link in $workItem.Links) { if ($link -is [Microsoft.TeamFoundation.WorkItemTracking.Client.ExternalLink] -and $link.ArtifactLinkType.Name -eq "Fixed in Changeset") { $csId = [int]($link.LinkedArtifactUri -replace ".+changeset\/", "") $changeset = $versionControl.GetChangeset($csId) #Write-Output "Changeset $csId" foreach ($change in $changeset.Changes) { #Write-Output " - $($change.Item.ServerItem)" $key=$change.Item.ServerItem if (-not $dict.ContainsKey($key)) { $dict[$key] = $csId } } } } foreach ($key in $dict.Keys) { #Write-Output "$key : $($dict[$key])" Write-Output $key Add-Content -Path "output.txt" -Value $key }
Wednesday
here is powershell script on how to get list of files from changesets associated with one tfs task
Subscribe to:
Post Comments (Atom)
here is powershell script on how to get list of files from changesets associated with one tfs task
$dllPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\...

-
Error:The element 'Schedule' has invalid child element 'RecurrenceRule'. List of possible elements expected: 'Occurring...
-
Here is instruction how to make blinking text in rainmeter: 1.right click and select " Edit skin " 2.add following code to temp...
-
2010-11-24 Update: Please download latest version of Pidgin , that has this problem fixed , no additional steps required. Here are 3 ways to...
No comments:
Post a Comment