Create a new WorkItem in TFS using the TFPT command line tool with line breaks in the Description field

How to add line break in the description field of a new WorkItem using TFST Power Tools command line utility? I tried this:

Z:\>tfpt workitem /new "Project Ipsum\Issue" /collection:http://myserver:8080/tfs/test /fields:"Title=Testing Command Line 3;Description=Description of issue goes here<br /><br />I'd like to have line breaks too" 

and this:

 Z:\>tfpt workitem /new "Project Ipsum\Issue" /collection:http://myserver:8080/tfs/test /fields:"Title=Testing Command Line 3;Description=Description of issue goes here\r\nI'd like to have line breaks too" 

to no avail.

Any suggestions there?

==============================

One solution I completed was to create a new (actually extended) work item with properties that I originally embedded in a long description. So now I have broken them into separate fields, for example:

 Z:\>tfpt workitem /new "Project Ipsum\Issue" /collection:http://myserver:8080/tfs/test /fields:"Title=Testing Command Line 3;Description=Description of issue goes here;Field1=more info;Field2=even more data" 

Then I created the form fields (a new group of tabs) to display them. However, it is cleaner.

It would still be interesting to determine how to add line breaks using TFPT.

Thanks.

+4
source share
3 answers

Hate to point this out, but I added a workaround that worked for me. Although I added a โ€œsolutionโ€ to my problem in my OP. Here for clarity (thanks for the concept of pantelif )

One solution I completed was to create a new (actually extended) work item with properties that I originally embedded in a long description. So now I have broken them into separate fields, for example:

 Z:\>tfpt workitem /new "Project Ipsum\Issue" /collection:http://myserver:8080/tfs/test /fields:"Title=Testing Command Line 3;Description=Description of issue goes here;Field1=more info;Field2=even more data" 

Then I created the form fields (a new group of tabs) to display them. However, it is cleaner.

It would still be interesting to determine how to add line breaks using TFPT.

0
source

Try it out . In your case:

  Z:\>set NLM=^ Z:\>set NL=^^^%NLM%%NLM%^%NLM%%NLM% Z:\>tfpt workitem /new "Project Ipsum\Issue" /collection:http://myserver:8080/tfs/test /fields:"Title=Testing Command Line 3;Description=Description of issue goes here%NL%I'd like to have line breaks too" 

UPDATE: see this link . Find a TobyKraft solution. He discovered that the HTML story is formatted. First you need to add a new work item, and then update your work history with the html formatted string using <br>.

+1
source

I do not know how to help you use tfpt.
You can create a small console application that uses the TFS-SDK instead, and complete the task as follows:

 using System; using Microsoft.TeamFoundation.Client; using Microsoft.TeamFoundation.WorkItemTracking.Client; namespace GenerateWorkItem { class Program { static void Main(string[] args) { TfsTeamProjectCollection tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://myserver:8080")); WorkItemStore workItemStore = (WorkItemStore)tpc.GetService(typeof(WorkItemStore)); Project teamProject = workItemStore.Projects["Ipsum"]; WorkItemType workItemType = teamProject.WorkItemTypes["Issue"]; WorkItem Issue = new WorkItem(workItemType) { Title = "Testing Command Line 3", Description = "Description of issue goes here \n I'd like to have line breaks too" } ; Issue.Save(); } } } 

It does its job. Now, if you make it depend on your string[] args , I expect the @Ludwo method presented will be useful.

The above grounds on this .

+1
source

Source: https://habr.com/ru/post/1379195/


All Articles