Exemplo n.º 1
0
        public static int SaveWorkitems(string path, AuthenticationHeaderValue header)
        {
            Directory.CreateDirectory(path);

            //List all workitem ids in batches of 200
            List <string> ids = new List <string>();
            int           i   = 0;
            StringBuilder sb  = new StringBuilder();

            JsonWITID[] wis = JsonConvert.DeserializeObject <JsonWITIDs>(NetworkUtil.HttpPostString(AzureURL.WIQLSURL, header, "{\"query\": \"Select [System.Id] From WorkItems\"}")).workitems;
            foreach (JsonWITID wi in wis)
            {
                if (i > 0)
                {
                    sb.Append(',');
                }
                sb.Append(wi.id);
                i = (i + 1) % 200;
                if (i == 0)
                {
                    ids.Add(sb.ToString());
                    sb.Clear();
                }
            }
            if (sb.Length > 0)
            {
                ids.Add(sb.ToString());
            }

            //Download workitems
            i = 0;
            foreach (string s in ids)
            {
                File.WriteAllText(Path.Combine(path, "workitems_" + (i++) + ".json"), NetworkUtil.HttpGetString(AzureURL.WORKITEMSURL + s, header));
            }
            return(wis.Length);
        }
Exemplo n.º 2
0
 public static JsonRepo[] ListRepositories(AuthenticationHeaderValue header)
 {
     return(JsonConvert.DeserializeObject <JsonRepos>(NetworkUtil.HttpGetString(AzureURL.REPOSURL, header)).value);
 }