locked
Problems using "tfpt workitem" RRS feed

  • Question

  • Hi,

    I am trying to use tfpt workitem and have some difficulties.


    1. How to create a workitem with a multiline description ?
    I tried "\n". It does not work. The \n is not interpreted.

    Code Snippet

    tfpt workitem /new "BacASable\Bogue" /fields:"System.Title=Thze title;Description=Here is a description\nwith a new line;System.AssignedTo=Arnaud" /s:medvts01




    2. How to use a file to set fields
    What is the correct syntax of such a file ?

    Code Snippet

    C:\>tfpt workitem /update "BacASable\Bogue" 2040 /fields:@bogue.txt /s:medvts01System.AssignedTo=Arnaud

    Input string was not in a correct format.

    C:\>type bogue.txt
    System.Title=Here is the title

    System.AssignedTo=Arnaud




    3. Finally one of our WorkItem definition is called "Demande de modification". I haven't found how to create a workitem of this kind :

    Code Snippet

    C:\>tfpt workitem /new "BacASable\Demande de modification" /fields:"System.Title=Here is the title;System.AssignedTo=Arnaud" /s:medvts01

    TF26201: This work item has unsupported fields, or user does not have permissions.



    Just replace "Demande de modification" with "Bogue" and it works fine.


    Any help appreciated.
    Thanks,

    Bona


    Thursday, September 25, 2008 8:17 AM

Answers

  •  

    Bona,  actually, we discuss command shell topic in Windows forum so I made that suggestion. TF26201 is thrown when saving a work item with invalid fields. Since you can create work item Demande de modification from the team explorer, I think there probably be some issue with field settings in command line arguments. Comparing field values you have entered in team explorer and fields in the command line may reveal us which field value is invalid. If there are some required fields, considering specify a default value.

    Wednesday, October 1, 2008 3:20 AM
  • Bill,

    you are right. One of the field value was not specified and should have been. It works fine when correct data are specified . Sorry for the mistake (I thought that there was a problem with a work item type with a name with a blank character as "Demande de modification").

    Thank you for your help.

    Bona
    Thursday, October 2, 2008 12:27 PM

All replies

  •  

    Hi Bona

     

    For question 1 and 2, they appear like how to input a string parameter that contains several lines in command line and how to use contents of file as parameters in command line. So, I think Windows Server General is better for this topic.

     

    For question 3, "Demande de modification" and "Bogue" are 2 different work item types, aren't them? Try this blog. Mak sure you can add work item from UI first, then try the command line.

    Monday, September 29, 2008 2:18 AM
  • Thank you for you answer Bill.

    For questions 1 and 2 (multiline parameters), I am not sure this is a windows general question, as it depends on how tfpt parses the arguments. The parsing depends on each application, and is not an OS specification. Anyway, the workaround for me was to use HTML instead of plain text. I just have to change the location of "Description" definition. The System.Description is "plain text", so no way to store HTML content. I will use "Microsoft.VSTS.CMMI.Symptom" instead.

    For question 3.
    Yes "Demande de modification" and "Bogue" are 2 different work item types. They both work with the UI. Thanks for the pointer.

    Bona
    Tuesday, September 30, 2008 1:40 PM
  •  

    Bona,  actually, we discuss command shell topic in Windows forum so I made that suggestion. TF26201 is thrown when saving a work item with invalid fields. Since you can create work item Demande de modification from the team explorer, I think there probably be some issue with field settings in command line arguments. Comparing field values you have entered in team explorer and fields in the command line may reveal us which field value is invalid. If there are some required fields, considering specify a default value.

    Wednesday, October 1, 2008 3:20 AM
  • Bill,

    you are right. One of the field value was not specified and should have been. It works fine when correct data are specified . Sorry for the mistake (I thought that there was a problem with a work item type with a name with a blank character as "Demande de modification").

    Thank you for your help.

    Bona
    Thursday, October 2, 2008 12:27 PM
  • Well if anyone has found this posting, they are trying to do something similar and get multi-line formatted text imported into workitems via the command line.  In my case, I wanted to add in history from bugzilla for our migrated bugs.

    It appears that System.History is treated as html formatted data so you can append html text from either the command line or an input file.

    C:\Projects\TFS\Jeff.Test>tfpt workitem /update 85 /fields:"History=Does this have multiple lines?<br>Second line.<br>Third line - some html"
    Work item 85 updated.
    C:\Projects\TFS\Jeff.Test>tfpt workitem /update 85 /fields:@c:\temp\tfsedit.txt
    Work item 85 updated.

    where tfsedit.txt contains:
    -----
    History=Multiline history comment<br>
    entered from<br>
    a text file with Break tags escape chars.
    <hr>
    Here is some more<br>text.
    <a href=http://www.google.com>Google link</a>
    -----

    Both methods work and you get multiple lines in the history entry created.

    Observations:

    1 - you need to ensure that you have no semi-colons in  your text, since that is the delimiter between diffferent fields
    2 - Not sure there is a way to get a semi-colon into the text since the entity encoding is "&#x3b;" and that doesn't work.

    so my questions are:
    1 - how do you import a semicolon?
    2 - where is the reference for all the Field Types and the import formats allowed?

    Thanks,


    Toby
    Friday, December 19, 2008 9:20 PM