shinjidev
shinjidev

Reputation: 397

How to get "Repro Steps" of a list of work items?

My team has been using VSTS for 8 months. Now, Our customer is asking to get "Repro Steps" of the work items in VSTS. Is there any way to get the content of "Repro Steps" without the HTML format?

Upvotes: 0

Views: 1167

Answers (1)

starian chen-MSFT
starian chen-MSFT

Reputation: 33698

No, because the Repro Steps value is the rich text that can contain image etc…. So, the value is incorrect if just return the data without HTML format.

However, you can remove HTML tag programing.

Simple code:

 public static string StripHTML(string input)
        {
            return Regex.Replace(input, "<.*?>", String.Empty);
        }



var u = new Uri("[collection URL]"");
 VssCredentials c = new VssCredentials(new Microsoft.VisualStudio.Services.Common.WindowsCredential(new NetworkCredential("[user name]", "[password]")));
 var connection = new VssConnection(u, c);
            var workitemClient = connection.GetClient<WorkItemTrackingHttpClient>();
            var workitem = workitemClient.GetWorkItemAsync(96).Result;
            object repoValue = workitem.Fields["Microsoft.VSTS.TCM.ReproSteps"];
            string repoValueWithOutformat = StripHTML(repoValue.ToString());

Upvotes: 1

Related Questions