Great Project

Mar 16, 2015 at 11:25 PM
This is a great project and just what I needed, thanks for the contribution. I went through the test project and can get everything to work. Problem is, I trying to get a list of all work items for a project, am I just missing something in the examples but I don't see a method for this? Any help would be appreciated.
Mar 17, 2015 at 12:50 AM
I think I found it but when I try to get the fields our of the WIQL the fields are empty, it is only giving me the Id, Url and Rev.
Mar 17, 2015 at 2:30 AM
Edited Mar 17, 2015 at 2:31 AM
I got it. This is probably way overly verbose but, I created a View Model to store my generated entity, grabbed all of the list ids for the WIQL and looped trough the GetWorkItems query to load them up.
            var vsoServiceWit = vsoClient.GetService<IVsoWit>();
            const string FLAT_QUERY = "Select [System.Id], [System.Title], [System.State] From WorkItems Where [System.WorkItemType] = 'Bug' AND [System.TeamProject] = @project order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc";

            var newQuery = vsoServiceWit.CreateQuery(project,
                "Shared Queries/Troubleshooting",
                string.Format("REST {0}", DateTime.Now.Ticks),

            var result = vsoServiceWit.RunFlatQuery(project, newQuery).Result.WorkItems;

            var workItemIds = new List<int>();

            foreach (var item in result)
                if(item.Id != 0)

            var vsoServiceWi = vsoClient.GetService<IVsoWit>();
            var wis = vsoServiceWi.GetWorkItems(workItemIds.ToArray()).Result.Items;

            var workItems = new List<WorkItemViewModel>();

            foreach (var item in wis)
                var wi = new WorkItemViewModel();
                wi.Id = Convert.ToInt32(item.Id);
                wi.State = item.Fields["System.State"].ToString();
                wi.Title = item.Fields["System.Title"].ToString();
                wi.Url = item.Url;

            return View(workItems);
Marked as answer by aknatn on 3/16/2015 at 7:31 PM
Mar 18, 2015 at 6:44 AM
I'm glad that it worked for you!