private IEnumerable <ClassificationNode> GetNodesRecursively(ClassificationNode node, string pattern) { if (node.ChildCount == 0 && _client != null) { node = new ClassificationNode(_client.GetClassificationNodeAsync(ProjectName, StructureGroup, node.RelativePath, 2) .GetResult($"Error retrieving {StructureGroup} from path '{node.RelativePath}'"), ProjectName, _client); } if (node.ChildCount == 0) { yield break; } foreach (var c in node.Children.Select(n => new ClassificationNode(n, ProjectName, _client))) { if (c.Path.IsLike(pattern)) { yield return(c); } foreach (var n in GetNodesRecursively(c, pattern)) { yield return(n); } } }
public WorkItemClassificationNode GetAreas(string project, int depth) { VssConnection connection = new VssConnection(_uri, _credentials); WorkItemTrackingHttpClient workItemTrackingHttpClient = connection.GetClient <WorkItemTrackingHttpClient>(); WorkItemClassificationNode result = workItemTrackingHttpClient.GetClassificationNodeAsync(project, TreeStructureGroup.Areas, null, depth).Result; return(result); }
public async static Task <WorkItemClassificationNode> GetClassificationNode(WorkItemTrackingHttpClient client, string project, TreeStructureGroup structureGroup) { Logger.LogInformation(LogDestination.File, $"Getting classification node for {client.BaseAddress.Host}"); return(await RetryHelper.RetryAsync(async() => { return await client.GetClassificationNodeAsync(project, structureGroup, depth: int.MaxValue); }, 5)); }
/// <summary> /// Add existing areas /// </summary> /// <param name="TeamProjectName"></param> /// <param name="TeamName"></param> static void AddTeamIterations(string TeamProjectName, string TeamName) { TeamContext teamContext = new TeamContext(TeamProjectName, TeamName); Console.WriteLine("Add iterations to the team " + TeamName); string[] iterations = { @"R2\R2.1\Ver1", @"R2\R2.1\Ver2" }; foreach (string it in iterations) { WorkItemClassificationNode projectIt = WitClient.GetClassificationNodeAsync(TeamProjectName, TreeStructureGroup.Iterations, it).Result; // get iteration from project TeamSettingsIteration teamIt = WorkClient.PostTeamIterationAsync(new TeamSettingsIteration { Id = projectIt.Identifier }, teamContext).Result; //add iteration to a team by guid Console.WriteLine("Added iteration " + teamIt.Name); } }
public WorkItemClassificationNode GetIteration(string project, string path) { VssConnection connection = new VssConnection(_uri, _credentials); WorkItemTrackingHttpClient workItemTrackingHttpClient = connection.GetClient <WorkItemTrackingHttpClient>(); WorkItemClassificationNode result = workItemTrackingHttpClient.GetClassificationNodeAsync(project, TreeStructureGroup.Iterations, path, 0).Result; return(result); }
public IEnumerable <WorkItemClassificationNode> GetAreas(string project, int depth = 100) { using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials)) { WorkItemClassificationNode result = workItemTrackingHttpClient.GetClassificationNodeAsync(project, TreeStructureGroup.Areas, null, depth).Result; IEnumerable <WorkItemClassificationNode> tree = result.Children; return(result != null?result.GetAllNodes() : null); } }
private void UpdateWorkItemTypes() { try { var tfsConnection = Globals.ThisAddIn.Settings.TfsConfigurations[cbProject.SelectedIndex]; WorkItemTrackingHttpClient witClient = GetVssClient(tfsConnection); var itemTypes = witClient.GetWorkItemTypesAsync(cbProject.Text).Result; var iterations = witClient.GetClassificationNodeAsync(cbProject.Text, TreeStructureGroup.Iterations, depth: 2).Result; var areas = witClient.GetClassificationNodeAsync(cbProject.Text, TreeStructureGroup.Areas, depth: 2).Result; var q = 1; } catch (System.Exception ex) { //todo: logging } }
public string GetIterations(string project, int depth) { using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials)) { WorkItemClassificationNode result = workItemTrackingHttpClient.GetClassificationNodeAsync(project, TreeStructureGroup.Iterations, null, depth).Result; } return("success"); }
private async Task SetAreaForTicket(JsonPatchDocument patchDocument, string projectName) { try { //It will throw an error if project does not exists and be created under a special area. //Only way to check if the tickets project is in an invalid state.. var areaFromXml = GetFieldFromSuperOfficeProject(CsvColumns.SuperOfficeIds, CsvColumns.AdsArea); var area = await _workItemTrackingHttpClient.GetClassificationNodeAsync(projectName, TreeStructureGroup.Areas, areaFromXml); if (area != null) { patchDocument.Add(CreateField("/fields/System.AreaPath", projectName + "\\" + areaFromXml)); } } catch (Exception ex) { //Maps the project to a dump area, when no relation between an area and a project cannot be found patchDocument.Add(CreateField("/fields/System.AreaPath", projectName + "\\" + "Skraldespanden")); //_logger.LogInformation(ex.Message, "Project could not be found: " + projectName); } }
public List <string> GetFullTree(string project, TreeStructureGroup type) { VssConnection connection = Context.Connection; WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient <WorkItemTrackingHttpClient>(); WorkItemClassificationNode rootNode = workItemTrackingClient.GetClassificationNodeAsync(project, type, null, 1000).Result; List <string> paths = new List <string>(); ShowNodeTree(rootNode); return(paths); }
public static async Task <IEnumerable <WorkItemClassificationNode> > GetAreasAsync(this WorkItemTrackingHttpClient source, string project, CancellationToken cancellationToken) { Logger.Debug($"Getting areas for '{project}'"); var root = await source.GetClassificationNodeAsync(project, TreeStructureGroup.Areas, null, depth : 20, cancellationToken : cancellationToken).ConfigureAwait(false); if (root != null) { return(root.Children); } return(Enumerable.Empty <WorkItemClassificationNode>()); }
public string GetIteration(string project, string path) { using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials)) { try { var result = workItemTrackingHttpClient.GetClassificationNodeAsync(project, TreeStructureGroup.Iterations, path, 0).Result; return("success"); } catch (System.AggregateException ex) { return(ex.InnerException.ToString()); } } }
public WorkItemClassificationNode ListIterations() { string projectName = ClientSampleHelpers.FindAnyProject(this.Context).Name; int depth = 4; VssConnection connection = Context.Connection; WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient <WorkItemTrackingHttpClient>(); WorkItemClassificationNode rootIterationNode = workItemTrackingClient.GetClassificationNodeAsync( projectName, TreeStructureGroup.Iterations, null, depth).Result; ShowNodeTree(rootIterationNode); return(rootIterationNode); }
public List <string> GetFullTree(string project, TreeStructureGroup type) { List <string> list = new List <string>(); VssConnection connection = new VssConnection(_uri, _credentials); WorkItemTrackingHttpClient workItemTrackingHttpClient = connection.GetClient <WorkItemTrackingHttpClient>(); WorkItemClassificationNode result = workItemTrackingHttpClient.GetClassificationNodeAsync(project, type, null, 1000).Result; list.Add(result.Name); foreach (var item in result.Children) { var name = result.Name + "/" + item.Name; list.Add(name); walkTreeNode(item, list, name); } return(list); }
public List <Iteration> GetIterationsList(int projectId) { List <Iteration> iterationList = new List <Iteration>(); List <WorkItemClassificationNode> projectIterations = _workItemTrackingClient.GetClassificationNodeAsync(OnlineTfsTeamProjectName, TreeStructureGroup.Iterations, depth: 5).Result.Children.ToList(); foreach (WorkItemClassificationNode iteration in projectIterations) { iterationList.Add(new Iteration { Depth = 1, Scope = null, ProjectId = projectId, IterationName = iteration.Name, IterationSourceId = iteration.Id, LastUpdatedDateTime = DateTime.UtcNow, EndDate = Convert.ToDateTime(iteration.Attributes?["finishDate"], CultureInfo.InvariantCulture), StartDate = Convert.ToDateTime(iteration.Attributes?["startDate"], CultureInfo.InvariantCulture) }); } return(iterationList); }
public IEnumerable <Iteration> GetProjectIterations(string projectId) { //iterations at depth 1 bec no iteration can be parent of another WorkItemClassificationNode rootNode = workItemClient.GetClassificationNodeAsync( projectId, TreeStructureGroup.Iterations, depth: 1).Result; List <Iteration> iterations = new List <Iteration>(); foreach (var iteration in rootNode.Children) { Iteration i = new Iteration { Id = iteration.Id, Name = iteration.Name, StartDate = iteration.Attributes["startDate"] != null?Convert.ToDateTime(iteration.Attributes["startDate"]) : default(DateTime), EndDate = iteration.Attributes["finishDate"] != null?Convert.ToDateTime(iteration.Attributes["finishDate"]) : default(DateTime), ProjectId = projectId }; iterations.Add(i); } return(iterations); }
public WorkItemClassificationNode GetIteration() { Guid projectId; string iterationPath; // Get values from previous sample method that created a sample iteration Context.TryGetValue <Guid>("$newIterationProjectId", out projectId); Context.TryGetValue <string>("$newIterationName", out iterationPath); VssConnection connection = Context.Connection; WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient <WorkItemTrackingHttpClient>(); WorkItemClassificationNode result = workItemTrackingClient.GetClassificationNodeAsync( projectId.ToString(), TreeStructureGroup.Iterations, iterationPath, 4).Result; // Show the new node ShowNodeTree(result); return(result); }
public WorkItemClassificationNode GetClassificationNode(string teamProjectName, TreeStructureGroup group) { return(_workItemTrackingHttpClient.GetClassificationNodeAsync(teamProjectName, group, depth: 999).Result); }