I need to update same field to same value for hundreds of workitems in TFS. Is there any way to do it in a batch instead of updating them manually one by one?
+7
A:
The short answer is:
- Open the work items in Excel, via:
- right click a query in Team Explorer -> open in Excel
- multi-select some work items in a WIT result pane, then right click -> open in Excel
- load Excel, use Team -> Import to load a predefined query
- open a *.xls file that is already bound to TFS
- Make your bulk edits
- Click the Publish button on the Team ribbon
Full documentation: Managing work items in Excel (overview page; lots & lots of links inside)
While I'm at it: You can bulk-edit in the web interface too
-- EDIT -- BY REQUEST --
Standard command line:
REM make Martin Woodward fix all my bugs
tfpt query /format:id "TeamProject\public\My Work Items" |
tfpt workitem /update @ /fields:"Assigned To=Martin"
Powershell:
# make Bill & Steve happy
$tfs = tfserver -path . -all
$items = $tfs.wit.Query("
SELECT id FROM workitems
WHERE [Created By] IN ('bill gates', 'steve ballmer')") |
% {
$_.Open()
$_.Fields["priority"].value = 1
$_
}
# note: this will be much faster than tfpt since it's only one server call
$tfs.wit.BatchSave($items)
Richard Berg
2009-07-31 04:45:54
Richard - could you do it with tfpt workitem as well?
Martin Woodward
2009-07-31 12:37:40
And powershell? (I know you want to dazzle with your l33t powershell skilz again :-) )
Martin Woodward
2009-07-31 12:38:15
Just for you, Martin :)
Richard Berg
2009-07-31 20:15:00