Quantcast
Channel: Team Foundation Server - General forum
Viewing all articles
Browse latest Browse all 6687

How can I get all iterations info of a project using javascript (Web Access custom control )?

$
0
0

Hi, I´m developing a TFS 2012 web access custom control and I need get all information of ,like startdate,enddate,iteartion name and so on.

I’ve just developed the same custom control for Visual Studio using "ICommonStructureService3", but I don't know how to achieve the same at web access control.

Below is the C# function and I want implement the same feature using JavaScript API in Webaccess (javascript)

 public List<TFSIteration> GetAllTFSIterations(Project par_project)
        {
            List<TFSIteration> listIteration = new List<TFSIteration>();
            try
            {
                //get the iterations xml
                NodeInfo[] structures = _css.ListStructures(par_project.Uri.ToString());
                NodeInfo iterations = structures.FirstOrDefault(n => n.StructureType.Equals("ProjectLifecycle"));
                XmlElement iterationsTree = _css.GetNodesXml(new[] { iterations.Uri }, true);
                //return iterationsTree;
                //translate all iterations to list of class Iteration
                XmlNodeList nodeList = iterationsTree.GetElementsByTagName("Node");
                foreach (XmlNode nodeIteration in nodeList)
                {
                    TFSIteration iteration = new TFSIteration();
                    iteration.nName = nodeIteration.Attributes["Name"].Value;
                    string iterNodePath = nodeIteration.Attributes["Path"].Value;//Path="\Demo_Project17\Iteration\Iteration 1"
                    Regex reg = new Regex(@"\\Iteration");
                    iterNodePath = reg.Replace(iterNodePath, "", 1);
                    Debug.WriteLine(iterNodePath);
                    iteration.nPath = iterNodePath.Remove(0, 1); ;//par_IterationPath = "Demo_Project17\Iteration 1"
                    if (nodeIteration.Attributes["StartDate"] != null && nodeIteration.Attributes["FinishDate"] != null)
                    {
                        iteration.nStartDate = System.Convert.ToDateTime(nodeIteration.Attributes["StartDate"].Value);
                        iteration.nFinishDate = System.Convert.ToDateTime(nodeIteration.Attributes["FinishDate"].Value);
                        listIteration.Add(iteration);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\r\n" + ex.StackTrace);
            }
            return listIteration;
        }

My question is how can it be implemented by using the Javascript API?

Any help or idea will be appreciate.

Thanks.



Viewing all articles
Browse latest Browse all 6687


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>