Example #1
0
        public void CreateStealing(string projectName, string username, string title, float time, string activity, bool leaveActive)
        {
            var stealingsUS = TFS.GetWorkItemWithRelations(StealingId);

            Dictionary <string, object> fields = new Dictionary <string, object>();

            fields.Add("Title", title);
            fields.Add("Activity", activity);
            fields.Add("Priority", 1);
            fields.Add("System.AssignedTo", username);
            fields.Add("System.AreaPath", stealingsUS.Fields["System.AreaPath"]);
            fields.Add("System.IterationPath", stealingsUS.Fields["System.IterationPath"]);
            fields.Add("Microsoft.VSTS.Scheduling.CompletedWork", time);

            var item = TFS.CreateWorkItem(projectName, "Eco Task", fields);

            TFS.AddParentLink(item.Id.Value, StealingId);

            fields.Clear();
            fields.Add("State", "Active");
            var r = TFS.UpdateWorkItem(item.Id.Value, fields);

            Console.WriteLine(r.Url);
            if (leaveActive == false)
            {
                fields.Clear();
                fields.Add("State", "Closed");
                var r2 = TFS.UpdateWorkItem(item.Id.Value, fields);
                Console.WriteLine(r2.Url);
            }
        }
Example #2
0
        private void RemoveCompleted(WorkItemElement element)
        {
            Dictionary <string, object> fields = new Dictionary <string, object>();

            fields.Add("Microsoft.VSTS.Scheduling.CompletedWork", 0);
            var r = TFS2.UpdateWorkItem(element.Id, fields);
        }