programing

TFS에서 여러 작업 항목을 일괄 업데이트하는 방법

css3 2023. 9. 12. 20:12

TFS에서 여러 작업 항목을 일괄 업데이트하는 방법

TFS에 있는 수백 개의 작업 항목에 대해 동일한 필드를 동일한 값으로 업데이트해야 합니다.일일이 수작업으로 업데이트하지 않고 일괄적으로 진행하는 방법은 없을까요?

Excel에서 이 작업을 수행할 수 있습니다.

  1. 다음을 통해 Excel에서 작업 항목을 엽니다.
    • Team Explorer에서 쿼리 마우스 오른쪽 버튼 클릭 -> Excel에서 열기
    • WIT 결과 창에서 일부 작업 항목을 여러 번 선택한 다음 Excel에서 -> 열기를 마우스 오른쪽 버튼으로 클릭합니다.
    • Excel을 로드하고 Team -> Import를 사용하여 미리 정의된 쿼리를 로드합니다.
    • TFS에 이미 바인딩된 *.xls 파일 열기
  2. 대량 편집
  3. 팀 리본에서 [등록] 단추를 누릅니다.

enter image description here

전체 문서 : 엑셀로 작업항목 관리 (개요페이지, 내부에 로트 & 로트 링크 있음)

웹 인터페이스에서도 대량 편집이 가능합니다.

Windows 명령줄:

REM make Martin Woodward fix all my bugs
tfpt query /format:id "TeamProject\public\My Work Items" | 
    tfpt workitem /update @ /fields:"Assigned To=Martin"

파워셸:

# 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)   
$secpasswd = ConvertTo-SecureString $TfsPasswd -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ($TfsUserName, $secpasswd)
Connect-TfsTeamProjectCollection -Server $TfsServerUrl -Collection $TfsCollection -Credential $mycreds
#Get-TfsTeamProject

Connect-TfsTeamProject -Project $TfsProjectName
$workItems  = Get-TfsWorkItem -Filter "[System.WorkItemType] = 'Bug' AND [System.AssignedTo] = '$TfsUserName'"
foreach ($workItem in $workItems)
{
    $tpc = $workItem.Store.TeamProjectCollection
    $id = $workItem.Id
    $store = $tpc.GetService([type]'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore')
    $wi = $store.GetWorkItem($id)
    $projectName = $wi.Project.Name
    foreach($fldName in $Fields.Keys)
    {
        $wi.Fields[$fldName].Value = $Fields[$fldName]
    }
    $wi.Save()
}

TFS의 여러 작업 항목을 PowerShell에서 일괄 업데이트하는 방법에서 세부 스크립트를 다운로드할 수 있습니다.

언급URL : https://stackoverflow.com/questions/1210571/how-to-batch-update-multiple-workitems-in-tfs