Ejemplo n.º 1
0
        /// <summary>
        /// Get template by name from default team
        /// </summary>
        /// <param name="projectName"></param>
        /// <param name="templateName"></param>
        /// <returns></returns>
        static WorkItemTemplate GetTemplate(string projectName, string templateName)
        {
            //get project team
            var project = ProjectClient.GetProject(projectName).Result;

            //get context for default project team
            TeamContext tmcntx = new TeamContext(project.Id, project.DefaultTeam.Id);

            //get all templates for team
            var templates = WitClient.GetTemplatesAsync(tmcntx).Result;

            //get tempate through its name
            var id = (from tm in templates where tm.Name == templateName select tm.Id).FirstOrDefault();

            if (id != null)
            {
                return(WitClient.GetTemplateAsync(tmcntx, id).Result);
            }

            return(null);
        }