Use WIQL to retrieve the results of a Team Query in TFS - tfs

Is there a way to retrieve the contents of a Team Query using WIQL?
Background: I'm throwing together an RSS feed for new bugs entered into TFS. I could write a specific WIQL query for which work item types and states to include, but I'd rather just include the name of a team query - that way the team query name could be specified in the querystring of the RSS feed's URL, and you could use it to watch any set of work items. Handy, right? I'm just not sure whether WIQL can select items from a Team Query. Anybody done that before?

No, there is no way to refer to or access a Team Query from within WIQL. The queries are stored in a separate subsystem in TFS that the query engine can't access.
Although it's not RSS, you might want to take a look at the OData Service for Team Foundation Server 2010.

Related

ADO equivalent to querying TFS in SQL?

In a previous incarnation I was able to query the TFS Data Warehouse using SQL, which gave me the ability to generate much more sophisticated queries than the TFS query editor and WIQL provided.
I've recently started working in ADO instead of TFS, and I'm wondering if ADO provides any equivalent kind of querying capability on the back end, as opposed to the limited capability that the ADO query editor and WIQL offer.
Any suggestions?
You can use Analytics Views and Power BI to get way more information than before about Work Items in your instance. You do get Analytics view in Build/Release/Tests as well, but you can't get them from Power BI.
Analytics Views

How to get work items for a specific team with wiql?

I'm trying to get work items in any state for a specific PROJECT and TEAM with dev ops rest api.
As confirmed in my old question, the backlog work item api won't do, because it doesn't return 'done' items.
What's the best way to do that with wiql?
I have issues in particular with filtering for a specific team.
The web interface leads to a query with the #TeamAreas macro but I can't figure out how to translate it to wiql, as Visual Studio 2017 says that "the syntax of the query is not supported".
Is there a way to translate the #TeamAreas macro, or is there a quick way to retrieve all the areas for a specific team?
There is no team field for work items. You need to get all team areas from team values: Teamfieldvalues - Get. This is my example with c# Manage Team Settings.
Then you may use this list in wiql.

TFS Query Editor: Is there a way to get the underlying WIQL for a given TFS shared query?

I've been asked to take a bunch of saved TFS Work Items > Shared Queries and reverse engineer them as SSRS reports for more elegant dashboarding.
For all of these I can right-click > Query Editor and it will take me to the Query Editing GUI, which has drop-down list for fields, but I'm not seeing any functionality that allows one to view the underlying WIQL query against the TFS_Warehouse (I'm assuming) database.
Question: Is there a way to get the underlying WIQL for a given TFS Shared Query?
I've done some searching on my own, and am finding multiple pages related to writing your own, but none where you can get the pre-existing for a shared query.
To get the underlying WIQL you can use File-Save as
Pick "file" as target option:
To create a warehouse query use the new report option in the Team tab in Excel. That will allow you to select a work item query which will be turned into a report.
See:
https://jessehouwing.net/vsts-tfs-generate-work-item-query-for-tfs-api/

Get User Stories with more than 5 Bugs in TFS

I want to select user stories with more than 5 bugs as children.
Using below query I can get user stories with at least one bug but filtering out the ones with less than 5 I'm lost.
How can I do this? Or is there any other way I can get this output? i.e: TFS extension
There is no build-in feature to count/filter linked work item's count of a specific work item type.
As a workaround, you could export tfs query results to Excel and manage the results in excel side. With the help of excel, you should be able to filter out those work items you needs.
Another way is using TFS API to get the work items and their linked work items with bug type, finally count the number of linked work items. About how to use API, please take a look at this related question: Retrieving work items and their linked work items in a single query using the TFS APIs
You can use in the query in "Related Link Count" field:

How to make a direct query to the DB in order to get the list of Iteractions by Team

Thinking in user stories, my requirement would be:
As a development department manager, I want to get the full list of iterations by team project, in order to have a full view of the milestones set for all the teams.
My initial approach is a query to the database. Which could be a good approach to build this query?
Is there another way to get it?
Querying the TfS operational store directly is unsupported and can lead to your system being unsupported. You should use the reporting tools instead.
TFS creates a data warehouse and cube where all the information is stored for reporting purpose's. You can just plug Excel into the data warehouse a query tye data that you need. If you want trend analysis you can also query the cube.
http://msdn.microsoft.com/en-us/library/bb649552.aspx
If you have team explorer installed you can also retrieve work items from queries to the operational store through the API. Any query that you can get in TFS you can load into excel.
http://msdn.microsoft.com/en-us/library/ms181675.aspx

Resources