Tfs via Python
I did some experiments interacting with Tfs through IronPython, and it's been enjoyable. They've done a great job making .NET available in a dynamic way through the Python language. IronPython can run as an interactive toplevel, where it responds to your commands as you give them. That's good because you get immediate feedback. Instead of a lengthy cycle of code - compile - launch - navigate to the location of the change - see result cycle, it's a quick try method - see result cycle. You can also quickly ask the system for a list of available methods of an object. I was able to test a few WorkItem queries directly to the API. See the result below.
I installed IronPython on my client machine and entered the following at the IronPythonConsole.exe prompt (”>>>”):
servername = "myServerName"
privateAssembliesPath = "c:\\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies"
import clr
clr.AddReferenceByPartialName("Microsoft.TeamFoundation")
clr.AddReferenceByPartialName("Microsoft.TeamFoundation.Common")
clr.AddReferenceByPartialName("Microsoft.TeamFoundation.Client")
clr.AddReferenceToFile(privateAssembliesPath + "\\Microsoft.TeamFoundation.WorkItemTracking.Client.dll")
from Microsoft.TeamFoundation.Server import *
from Microsoft.TeamFoundation.Proxy import *
from Microsoft.TeamFoundation.Client import *
from Microsoft.TeamFoundation.WorkItemTracking.Client import *
tfs = TeamFoundationServerFactory.GetServer(servername)
wis = tfs.GetService(WorkItemStore)
for p in wis.Projects:
print p.Name
query = "SELECT [System.Id],[System.State], [System.Title] FROM WorkItems \
WHERE [System.State] <> 'Closed' ORDER BY \
[System.WorkItemType], [System.Id]"
workitems = wis.Query(query)
for wi in workitems:
print wi.Title