2011-10-03 63 views

回答

1

Shai Raiten已经对此here进行了博客,他使用DestroyWorkItems(ids)

建议您在实施过程中小心谨慎,因为这会严重影响安装。有人可能会认为构建这样的工具偏离了最佳实践。

-1

您也可以use PowerShell to bulk delete work items

复制并粘贴以下脚本在PowerShell的文件(名为.ps1 扩展),更新以下 列表#4中提到的变量值和从运行命令安装了witadmin工具的机器 (通常在Visual Studio安装后可用)。打开 PowerShell命令窗口并执行脚本。 注意:在脚本下运行的帐户应具有团队基础管理员或集合管理员访问权限。

########TFS Work Items Bulk Destroy Automation Script########## 
#Notes: 
#1) This script requires to setup file/folder path, validate the file/folders path before running the script 
#2) start the powershell window as Administrator and run the script 
#3) This script requires share and admin access on the destination server, make sure your account or the account under which script is 
# executing is member of admin group on the destination server 
#4) Update following: 
# 4.1: $CollectionURL 
# 4.2: $WitAdmin tool location 
     # For VS 2015, Default location is C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE 
     # For VS 2013, Default location is C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE 
# 4.3: $WI_List 
# 4.4: $logfile 
#################### 

$CollectionURL = "http://tfs:8080/tfs/CollectionName" 
$WitAdminLocation = "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE" 
$WI_List = Get-Content "C:\WI_List.txt" 
$logfile="C:\log.txt" 
$ExecutionStartTime = Get-Date 
$WICount = 0 
"## Starting WI Destroy @ $ExecutionStartTime ##"| Out-File $logfile -Append 
"Collection URL: $CollectionURL" | Out-File $logfile -Append 
foreach ($WIID in $WI_List) 
    { 
     CD $WitAdminLocation 
     .\witadmin destroywi /collection:$CollectionURL /id:$WIID /noprompt 
     "WI ID: $WIID Destroyed" | Out-File $logfile -Append 
     $WICount = $WICount + 1 
     Write-Host "$WICount Work Items Deleted" 
    } 

$ExecutionEndTime = Get-Date 
"## WI Destroy Command Completed @ $ExecutionEndTime ##"| Out-File $logfile -Append 

$TotalExecutionTime = $ExecutionEndTime - $ExecutionStartTime 

"Total Work Items Deleted: $WICount" | Out-File $logfile -Append 

" Total Execution Time: $TotalExecutionTime" | Out-File $logfile -Append 

##End of script## 
+2

将相关信息放入帖子中。 –

+0

虽然这个链接可能回答这个问题,但最好在这里包含答案的基本部分,并提供供参考的链接。如果链接页面更改,则仅链接答案可能会失效 – davejal