I was asked by a colleague to provide a list of all files that were changed under a particular iteration. Rather than delving into the data, I made a couple of API calls to TFS to output a text file with the list.
This is probably not the most efficient method and it is hard coded, but it does output the goods:
1Dim tfs As New TeamFoundationServer("http://testtfs01:8080")
2Dim store As WorkItemStore = tfs.GetService(GetType(WorkItemStore))
3Dim version As VersionControlServer = tfs.GetService(GetType(VersionControlServer))
4' Query for work items
5Dim query As String = "SELECT [System.Id], [System.Title] " _
6 & "FROM WorkItems " _
7 & "WHERE [System.TeamProject] = @Project " _
8 & "AND [System.IterationPath] UNDER @IterationPath " _
9 & "ORDER BY [System.Id]"
10Dim paramiters As New Hashtable
11paramiters.Add("Project", "TestProject1")
12paramiters.Add("IterationPath", "TestProject1TestIteration1")
13Dim y As WorkItemCollection = store.Query(query, paramiters)
14Console.WriteLine(String.Format("Found {0} work items", y.Count))
15' Query work items for attachments
16Dim wiats = From wi As WorkItem In y, l As Link In wi.Links Where l.BaseType = BaseLinkType.ExternalLink Select l, wi
17Console.WriteLine(String.Format("Loading {0} changesets...", wiats.Count))
18Dim ChangeSets As New List(Of Changeset)
19If Not wiats Is Nothing Then
20 Dim els = From i In wiats Where LinkingUtilities.DecodeUri(CType(i.l, ExternalLink).LinkedArtifactUri).ArtifactType = "Changeset"
21 For Each i In wiats
22 Dim el As ExternalLink = CType(i.l, ExternalLink)
23 Dim artifact As ArtifactId = LinkingUtilities.DecodeUri(el.LinkedArtifactUri)
24 If artifact.ArtifactType = "Changeset" Then
25 Dim cs As Changeset = version.ArtifactProvider.GetChangeset(New Uri(el.LinkedArtifactUri))
26 ChangeSets.Add(cs)
27 End If
28 Next
29 ' ------------------------------
30 Console.WriteLine(String.Format("{0} changesets loaded", ChangeSets.Count))
31 Dim files = From f In ChangeSets, c In f.Changes Select c.Item Distinct
32 Using x = System.IO.File.CreateText("c:Tempfiles.txt")
33 For Each f In files
34 x.WriteLine(f.ServerItem)
35 Next
36
37 End Using
38
39End If
40If Debugger.IsAttached Then
41 Console.ReadKey()
42End If
As you can see I have very bad naming and layout, but this is a one time use version of the code, so quick and dirty. If I am asked to do this again I would create a proper command line utility, or even a WPF interface to display the data prettily.
Technorati Tags: ALM WIT TFS Custom TFBS Version Control WPF TFS
No related videos found.
If you've made it this far, it's worth connecting with our principal consultant and coach, Martin Hinshelwood, for a 30-minute 'ask me anything' call.
We partner with businesses across diverse industries, including finance, insurance, healthcare, pharmaceuticals, technology, engineering, transportation, hospitality, entertainment, legal, government, and military sectors.
Brandes Investment Partners L.P.
DFDS
Workday
Microsoft
Boxit Document Solutions
Alignment Healthcare
Big Data for Humans
Milliman
Deliotte
Slicedbread
Hubtel Ghana
Kongsberg Maritime
Akaditi
MacDonald Humfrey (Automation) Ltd.
Capita Secure Information Solutions Ltd
Emerson Process Management
Graham & Brown
Schlumberger
Nottingham County Council
Royal Air Force
Ghana Police Service
Washington Department of Transport
Department of Work and Pensions (UK)
New Hampshire Supreme Court
Lean SA
Schlumberger
Capita Secure Information Solutions Ltd
Emerson Process Management
Bistech
New Signature