You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在TFS中查询各Release#对应的关联工作项数量?

How to Count Linked Work Items per TFS Release Number

Hey there! I’ve been in your shoes before—tracking work items linked to TFS releases can feel tricky if you don’t know the right shortcuts. Here are a few straightforward methods I’ve used to get that count easily:

1. Quick Manual Check via TFS Web Portal

If you only need to look up individual releases one at a time:

  • Navigate to your target release in the TFS Releases hub
  • Switch to the Linked Work Items tab at the top of the release details page
  • The total count of linked work items is usually displayed prominently at the top of this tab (look for a label like "X work items linked")

For bulk or automated reporting, check out the methods below.

2. Azure DevOps CLI (Automated/Bulk Queries)

If you prefer command-line workflows (compatible with TFS 2018+):

  • First, authenticate with your TFS server using az devops login (for on-prem instances) or az login (for cloud-hosted)
  • To get the count for a single release, run:
    az pipelines release show --id <RELEASE_ID> --organization https://your-tfs-server/DefaultCollection --project "Your Project Name" --query 'workItems.count'
    
  • For bulk processing, write a simple PowerShell/Bash script that loops through a list of release IDs, runs the command for each, and outputs a clean list of release numbers + work item counts.

3. TFS REST API (Custom Scripting)

You can pull this data programmatically using the TFS REST API:

  • The endpoint for linked work items of a release is:
    https://<your-tfs-server>/DefaultCollection/_apis/release/releases/<RELEASE_ID>/workitems?api-version=6.0
    
  • Send a GET request to this endpoint, then extract the count value from the JSON response.
  • Example PowerShell snippet to fetch the count:
    $releaseId = 123
    $uri = "https://your-tfs-server/DefaultCollection/_apis/release/releases/$releaseId/workitems?api-version=6.0"
    $response = Invoke-RestMethod -Uri $uri -UseDefaultCredentials
    Write-Host "Release $releaseId has $($response.count) linked work items"
    
  • Scale this into a script to iterate over multiple releases and compile a formatted report.

4. Power BI Integration (Visual, Shareable Reports)

For a visual, team-friendly report:

  • Connect Power BI to your TFS server using the "Azure DevOps" data source
  • Import the Releases and Work Items tables
  • Create a relationship between the two tables using release ID/link fields
  • Build a table or card visualization that groups by release number and counts linked work items. This lets you filter, sort, and share insights with your team easily.

Quick Tips

  • For older TFS versions (pre-2018), use the legacy tf.exe tool instead of Azure DevOps CLI, though its work item query capabilities are more limited.
  • If you need to count specific work item types (e.g., only bugs or user stories), add filters to your CLI/API queries or Power BI report.

内容的提问来源于stack exchange,提问作者vvadali

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:12:02