Posts

Showing posts from May, 2019

Using @CurrentIteration with TFS API

Image
@CurrentIteration is neat macro I use when I created saved queries in TFS. For example, I recently needed to write a query that fetched all current bugs in the sprint: This works great in the TFS web interface. The main reason for me to create this saved query was however was to be able to access it via the TFS API. So I started like this: using ( var workItemTrackingHttpClient = new WorkItemTrackingHttpClient ( new Uri ( " http://mytfs/tfs/Plato " ) , new VssCredentials ( ) ) ) { try { var items = workItemTrackingHttpClient . QueryByIdAsync ( new Guid ( " 25c6e737-d0ce-416f-9f7a-3cb78959334d " ) ) . Result . WorkItems ; } catch ( Exception ex ) { } } This returned the following error: System.AggregateException: One or more errors occurred. ---> Microsoft.VisualStudio.Services.Common.VssServiceException: VS402612: The macro '@CurrentIteration