private static void TestExcelExtraction(ConnectionManager connection) { WorkItemManger workItemManger = new WorkItemManger(connection); workItemManger.SetTeamProject("CMMI Playground"); var hr = workItemManger.ExecuteHierarchicQuery(@"SELECT * FROM workitemLinks WHERE ( [Source].[System.TeamProject] = '{teamProjectName}' AND[Source].[System.WorkItemType] = 'Feature' AND[Source].[Microsoft.VSTS.Scheduling.TargetDate] < '2062-01-01T00:00:00.0000000' AND[Source].[Microsoft.VSTS.Scheduling.TargetDate] > '1990-02-02T00:00:00.0000000' ) AND( [System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward' ) AND( [Target].[System.TeamProject] = '{teamProjectName}' AND[Target].[System.WorkItemType] <> '' ) MODE(Recursive) ", new[] { "task", "requirement", "feature", "epic" }); var tempFile = @"c:\temp\test2.xlsx"; if (File.Exists(tempFile)) { File.Delete(tempFile); } File.Copy(@"c:\temp\test.xlsx", tempFile); using (ExcelManipulator m = new ExcelManipulator(tempFile)) { m.FillWorkItems(hr); } System.Diagnostics.Process.Start(tempFile); }
public override void AssembleExcel( ExcelManipulator manipulator, Dictionary <string, object> parameters, ConnectionManager connectionManager, WordTemplateFolderManager wordTemplateFolderManager, string teamProjectName) { WorkItemManger workItemManger = PrepareWorkItemManager(connectionManager, teamProjectName); //If we do not have query parameters we have a single query or we can have parametrized query with iterationPath var queries = PrepareQueries(parameters); foreach (var query in queries) { if (HierarchyMode?.Length > 0) { var hr = workItemManger.ExecuteHierarchicQuery(query, HierarchyMode); manipulator.FillWorkItems(hr); } else { throw new NotSupportedException("This version of the program only support hierarchy mode for excel"); } } }