Ravendra's Blog

June 2, 2010

Bulk edit TFS Work items

Filed under: Team foundation server 2010 — Ravendra Mishra @ 3:34 pm

TFS power tools command enable to make bulk edit on work items filtered through queries.

Consider a particular scenario when a team member is leaving the project and you want to assign all the stories, bugs etc assigned to him to a new member and also want to provide related comments. Using UI this task may be quite time consuming.

For example: Updating all work items assigned to me to be assigned to Jason (uses Query)

tfpt Query /format:id “project1\Team Queries\My Work Items” | tfpt workitem /update @ /fields:”Assigned To=Jason”

 

All other options of this command are as below:

C:\Program Files\Microsoft Team Foundation Server 2010 Power Tools>tfpt workitem /?

tfpt workitem – Create, update, or view work items

Usage: tfpt workitem [workitemid1 workitemid2 … | @ | @filename]

Usage: tfpt workitem /new type /fields:[field1=value1[;field2=value2;…]|@filename]

Usage: tfpt workitem /update [workitemid1 workitemid2 … | @ | @filename] /fields:[field1=value1[;field2=value2;…]|@filename]

Usage: tfpt workitem /uploadattachment workitemid /recursive /comment:[commenttext|@filename] file1 [file2] [file3 …]

Usage: tfpt workitem /downloadattachment workitemid [filepattern1 …] /path:folder

 

/new Specifies that a new work item of the type entered be created. The number of the new work item is displayed.

type Represents the name of the work item type to create. Use the form <project>\<workItemType>.

/update Specifies that work items should be updated. To read the list of work items from stdin put ‘@’ on the commandline. Use ‘@filename’ to read from a file.

/fields Specifies the fields that are changed and the new values to give to them.

fieldN The name of a field to update.

valueN The value to set on the fieldN.

filename The file that has the field/value pairs to use.

/uploadAttachment Specifies that files should be uploaded and attached to the work item.

/comment Specifies a comment to associate with the attachments.

commenttext The text for the comment.

filename The file that contains the text for the comment.

/recursive Include subdirectories when searching for files.

 

/downloadAttachment Specifies that attachments should be downloaded to the current path.

/path Specifies a path to download the files to

folder The folder to download files to.

 

workitemidN Specifies the id of the work item to retrieve.

fileN Represents the name of a file to upload. File patterns are supported (i.e. *.cs).

fileN Represents the name of a file to upload. File patterns are supported (i.e. *.cs).

filePatternN Represents the name of an attachment to download. File patterns are supported (i.e. *.cs).

 

/server:servername Specifies the URL of the Team Foundation server to connect to.

Example: /server:http://mytfsserver:8080/

Examples:

Creating a new Bug work item with a title of ‘New’ and assigned to Jason

tfpt workitem /new project1\Bug /fields:”Title=New;Assigned To=Jason”

 

Updating work item 123 with field values from a file

tfpt workitem /update 123 /fields:@myFieldValues.txt

 

Updating all work items assigned to me to be assigned to Jason (uses Query)

tfpt Query /format:id “project1\Team Queries\My Work Items” | tfpt workitem /update @ /fields:”Assigned To=Jason”

Advertisements

6 Comments »

  1. That’s an amazing post. Thanks a lot

    Comment by nikolaus in koln — June 21, 2010 @ 3:05 am | Reply

  2. hi,
    thanks..i still have a error:
    tfpt Query /collection:http://TFS:8080/tfs/defaultcollection /format:id querypath: “projecTeam\Team Queries\tomodify” | tfpt workitem /update /collection:http://TFS:8080/tfs/defaultcollection @ /fields:state=Proposed, field:”reason=”migrating template”
    After login
    i get the message “Specify one stored query name”
    please advise,
    thanks
    hila@teamuto.com

    Comment by hila — July 19, 2011 @ 2:06 pm | Reply

  3. A great example would be illustrating an update that pulls multiple fields from a file – not the command line but the file… and then one that pulls test case steps – again show the file content… because I have yet to see these work; What I find here so far is largely replication of the command line help… not anything new

    Comment by JWS — April 29, 2013 @ 8:14 pm | Reply

  4. Hi! I could have sworn I’ve visited this site before but after
    going through many of the posts I realized it’s new to me.
    Anyhow, I’m certainly happy I stumbled upon it and I’ll be book-marking it and checking
    back frequently!

    Comment by Airsoft Gear — May 27, 2015 @ 9:05 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: