コード例 #1
0
        public WorkItemTemplate CreateTemplate()
        {
            VssConnection connection          = Context.Connection;
            WorkItemTrackingHttpClient client = connection.GetClient <WorkItemTrackingHttpClient>();

            Dictionary <string, string> field = new Dictionary <string, string>
            {
                { "System.State", "New" }
            };

            WorkItemTemplate newTemplate = new WorkItemTemplate()
            {
                Name             = "Test Template",
                Description      = "Template to be created",
                WorkItemTypeName = "Feature",
                Fields           = field
            };
            WorkItemTemplate result = null;

            try
            {
                result = client.CreateTemplateAsync(newTemplate, getTeamContext()).Result;
                Context.SetValue <Guid>("$newTemplateId", result.Id);
                Console.WriteLine("Create template Successed.");
            }
            catch (Exception e)
            {
                Console.WriteLine("Create template Failed:" + e.Message);
            }
            return(result);
        }