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

Azure DevOps技术问询:如何查询Work Item曾关联的Tags及Tags变更时间?

Querying Historical Tags and Tag Change Times in Azure DevOps Work Items

Great questions—these are common pain points since Azure DevOps’ default query tools don’t expose historical tag data directly, but there are practical workarounds using built-in features and APIs. Let’s break down solutions for both requirements step by step:

1. How to Check if a Work Item Ever Had a Specific Tag

Azure DevOps’ standard work item queries only show current tag values, so you’ll need to tap into historical data sources:

  • Quick Manual Check via Work Item History Tab
    For individual work items, open the item, navigate to the History tab, and use the search bar to look for your target tag. You’ll see entries labeled Changed Tags that explicitly mention adding or removing the tag. This is perfect for one-off verifications.

  • Query Historical Data with Azure DevOps Analytics Service (OData)
    The Analytics Service retains full revision history for work items, including past tag values. You can write an OData query to filter work items that ever had your target tag. Example query:

    https://analytics.dev.azure.com/{organization}/{project}/_odata/v3.0-preview/WorkItemRevisions
    ?$filter=Tags/any(t: t eq 'YourTargetTag')
    &$select=WorkItemId, Title, Tags, Revision, RevisedDate
    

    This returns all revisions of work items where the tag was present at any point. You can run this directly in the Analytics portal or use it in tools like Power BI for bulk analysis.

  • Fetch and Parse Changes via REST API
    Call the Work Item History API to retrieve all change events for a specific work item, then check if the target tag ever appeared in tag modifications. The endpoint is:

    GET https://dev.azure.com/{organization}/{project}/_apis/wit/workItems/{id}/history?api-version=7.1-preview.3
    

    In the response, look for entries where fieldName equals System.Tags—each entry will show old and new tag values, letting you confirm if your target tag was ever associated with the item.

2. How to Find Exact Timestamps for Tag Changes

Since default queries can’t filter Changed Tags history entries, use these methods to get precise modification times:

  • Extract Timestamps from REST API History
    Using the same REST API endpoint above, every System.Tags change entry includes a changedDate field with the exact UTC timestamp of the modification. For example, a response snippet might look like:

    {
      "id": 12345,
      "changedDate": "2024-05-20T14:30:00.000Z",
      "fields": {
        "System.Tags": {
          "oldValue": "TagA",
          "newValue": "TagA, TagB"
        }
      }
    }
    

    This tells you TagB was added at 14:30 UTC on May 20, 2024.

  • Leverage Analytics Service for Bulk Timestamp Tracking
    Extend the earlier OData query to include the RevisedDate field (the timestamp of the revision where the tag change occurred). You can compare tag values across consecutive revisions to identify exactly when a tag was added or removed.

  • Bulk Analysis with Power BI
    Connect Power BI to your Azure DevOps project’s Analytics data source, then build a custom report. You can create a table that shows work item ID, tag name, change type (added/removed), and the timestamp pulled from RevisedDate—this is ideal for analyzing tag changes across multiple work items.

  • Automated Tracking for Enterprise Use Cases
    If you need ongoing, centralized tracking of tag changes, set up an Azure Function that listens to the WorkItemUpdated event in Azure DevOps. When a tag is modified, the function can log the work item ID, tag name, change type, and timestamp to a database (like Azure SQL or Cosmos DB) for easy, future querying.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.27 21:27:34