Created
April 28, 2014 13:57
-
-
Save glombard/11372920 to your computer and use it in GitHub Desktop.
Access TFS API using PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@( | |
'Microsoft.TeamFoundation.Build.Client', | |
'Microsoft.TeamFoundation.Build.Common', | |
'Microsoft.TeamFoundation.Client', | |
'Microsoft.TeamFoundation.WorkItemTracking.Client' | |
) | % { | |
[Reflection.Assembly]::LoadWithPartialName($_) | Out-Null | |
} | |
$uri = [URI]"https://my-tfs-online.visualstudio.com/DefaultCollection/" | |
$projectCollection = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($uri) | |
$wis = $projectCollection.GetService([Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore]) | |
$col = $wis.Query(@" | |
Select [State], [Title] | |
From WorkItems | |
Where [System.TeamProject] = 'My Project' | |
Order By [State] Asc, [Changed Date] Desc | |
"@) | |
$col | Format-Table -Property Id, State, Title -AutoSize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment