Beispiel #1
0
        public async Task <string> GetTasks(string projectName)
        {
            var content = new StringContent(
                "{\"query\": " +
                "\"Select [System.Id], [System.Title], [System.State] " +
                "From WorkItems Where [System.WorkItemType] = 'Task' AND [State] <> 'Closed' AND [State] <> 'Removed' And [Assigned To] = @Me " +
                "order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc\"}",
                System.Text.Encoding.UTF8, "application/json");

            var result = await this.PostHttp(string.Format("{0}/{1}/_apis/wit/wiql?api-version={2}", URI_PREFIX, projectName, API_VERSION), content);

            WorkItemResponse response = JsonConvert.DeserializeObject <WorkItemResponse>(result, this.CreateJsonSettings());

            return(await this.GetTasksDetails(response));
        }
Beispiel #2
0
        public async Task <string> GetTasksDetails(WorkItemResponse response)
        {
            var count = 1;
            var ids   = new StringBuilder("ids=");

            foreach (var item in response.WorkItems)
            {
                ids.Append(item.Id);
                if (count > 200)
                {
                    break;
                }
                if (count < response.WorkItems.Count)
                {
                    ids.Append(',');
                }

                count++;
            }

            return(await this.GetHttp(string.Format("{0}/_apis/wit/workitems?{1}&api-version={2}", URI_PREFIX, ids.ToString(), API_VERSION)));
        }