
Azure DevOps query can be a powerful tool to track changes over time and identify who made changes to your code. This is especially useful for large teams or projects with multiple contributors.
Using the "Changes" tab in Azure DevOps, you can view a history of all changes made to your code, including who made the change and when. This information can be filtered by date, user, and even specific files or folders.
By using the "Query" feature in Azure DevOps, you can create a custom query to track changes over time and identify who made changes to specific files or folders. For example, you can use the "Changed By" column to filter changes made by specific users.
This can be incredibly helpful in identifying who made changes to critical code and when, allowing you to quickly resolve issues and improve your development process.
Recommended read: Using Vscode for Azure Devops
Azure DevOps Query Basics
Azure DevOps queries can be a powerful tool to track changes made by team members.
In Azure DevOps, you can use queries to execute a search on items like work items, commits, or builds.
You can use queries to find changes made within a specific timeframe, such as the last 7 days.
To do this, you can use the "Changed Date" field in your query.
This field allows you to filter items based on when they were last changed.
Azure DevOps also allows you to export query results to an HTML page, which can be helpful for keeping track of changes over time.
Suggestion: Does Matomo Use Cookies
Change Tracking and Auditing
Change tracking and auditing are essential features in Azure DevOps that help you keep a record of changes made to work items. You can use the History field to view the record of changes made to a work item after it was created. This field is automatically indexed for full-text search.
The History field is populated with information as a work item progresses from one state to another, and it updates when the work item is modified. It's not possible to add formatted text to the history field, and once you've saved the work item, you can't alter the history.
Check this out: How to Filter Unread Text Messages on Iphone
You can use the History tab to track all changes made to a work item, but the long revision history can make it difficult to understand when changes happen to specific fields. To quickly find revisions made to a specific field or by specific people, filter the history view.
The State Change Date field can be used to narrow the search and then add clauses for changes to the State field. This allows you to list work items that have changed state within a specific date range.
Here are some key fields related to change tracking and auditing:
- System.ChangedBy: The name of the team member who modified the work item most recently.
- System.ChangedDate: The date and time when a work item was modified.
- Microsoft.VSTS.Common.ClosedDate: The date and time when a work item was closed.
- System.CreatedDate: The date and time when a work item was created.
- System.History: The record of changes that were made to the work item after it was created.
- Microsoft.VSTS.Common.StateChangeDate: The date and time when the value of the State field changed.
These fields can be used to create reports and filter queries, and they're automatically indexed for full-text search.
Advanced Filtering
To quickly find revisions made to a specific field or by specific people, filter the history view.
The History tab is a powerful tool for tracking all changes made to a work item, but its long revision history can be overwhelming. You can enable the Toggle filter feature to make it easier to understand when changes happen to specific fields.
To review updates by specific people, select their names from the Updated by menu. This feature requires you to enable the New Boards Hub preview feature, which you can do by following the instructions in the Manage or enable features section.
To quickly find revisions made to a specific field, use the query editor to narrow down your search. You can select from query fields, operators, and macros to create a custom query.
Here are some query options to get you started:
- Query editor
- Query fields, operators, and macros
- Query by date or current iteration
API and Export Options
Azure DevOps provides various options to customize your query results. You can export changes in query results to an HTML page.
The tool helps you monitor many items and identify changes within a specified timeframe, such as the last 7 days. This is especially useful when tracking field changes on associated items, like Features.
You can also use the Azure DevOps query to execute a query and look for changes within a certain period, like the last x days.
You might like: How to Group Clauses in Azure Devops Query
Rest Api
If you need to programmatically interact with queries, you can use the Azure DevOps Services REST API, which provides a comprehensive reference for building custom applications.
The Azure DevOps Services REST API Reference is a great place to start, as it outlines the available resources and endpoints for querying work items.
You can use the Queries resource to fetch work items with specific criteria, such as work item IDs or queries.
The Work item query language is also a crucial aspect of the REST API, allowing you to construct complex queries using a standardized syntax.
To fetch work items with queries programmatically, you can use the Fetch work items with queries resource, which provides a detailed guide on how to do so.
Here's a summary of the key resources mentioned:
- Azure DevOps Services REST API Reference
- Queries
- Work item query language
- Fetch work items with queries programmatically
Azure DevOps - Export Changes
You can use the Azure DevOps tool to export changes in query results, which is super helpful for keeping track of items that change rarely.
This tool executes the query, looks for changes in the resulting items within the last x days, and exports the result to an HTML page.
You can use it to see changes on associated items, such as Features, with field changes within the last say 7 days.
To export an existing query as a wiql query, you'll need to install the Azure DevOps Wiql Editor extension.
You'll then need to copy the query to the ado-query.wiql file and replace @project with '{0}', so the program can replace the project from the env file into the query prior to executing.
You can configure how many days to take into account when determining changes to an item using the QUERY_DAYS variable.
The organization is the first part in the URL after dev.azure.com, and the project follows after the organization.
This tool is especially useful for monitoring many items and seeing changes over time.
For your interest: Most Important Metrics Builders Need to Keep Track of
Tools and Examples
To run the Azure DevOps query tool, you need to add an .env file and an appsettings.json file in the same folder as the tool. This will allow you to adjust the WIQL query in the ado-query.wiql file and execute the .\AdoQueries.exe command to get the output HTML stored in the same folder.
The output HTML will contain the results of your query. To get started, you'll need to add an .env file and an appsettings.json file in the same folder as the tool.
To create a query that shows who made changes, you can use the WIQL query in the ado-query.wiql file. This file contains examples of useful queries, including one that shows "High-priority items I'm following".
Here are some useful query examples:
These examples show how you can use the WIQL query to create different types of queries. You can share query templates with your teammates to create consistent follow-up workflows.
Featured Images: pexels.com


