TFS에서 여러 WorkItems를 업데이트하는 방법
-
06-07-2019 - |
문제
TFS의 수백 개의 워크 시티에 대해 동일한 필드를 동일한 값으로 업데이트해야합니다. 수동으로 하나씩 업데이트하는 대신 배치로 수행 할 수있는 방법이 있습니까?
해결책
당신은 이것을 할 수 있습니다 뛰어나다:
- 다음을 통해 Excel에서 작업 항목을 엽니 다.
- Team Explorer에서 쿼리를 마우스 오른쪽 버튼으로 클릭하십시오 -> Excel에서 열립니다.
- 재치 결과 창에서 일부 작업 항목을 다중 선택 한 다음 마우스 오른쪽 버튼을 클릭하십시오.
- Excel로드, 팀 -> 가져 오기에 미리 정의 된 쿼리를로드하십시오.
- 이미 TFS에 바인딩 된 *.xls 파일을 엽니 다
- 대량 편집을 만드십시오
- 팀 리본의 게시 버튼을 클릭하십시오
전체 문서 :Excel에서 작업 항목 관리 (개요 페이지; 내부의 로트 및 많은 링크)
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"
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)
다른 팁
$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()
}
세부 스크립트를 다운로드 할 수 있습니다 PowerShell의 TFS에서 여러 작업 항목을 업데이트하는 방법
제휴하지 않습니다 StackOverflow