John Henckel
John Henckel

Reputation: 11417

Retrieve the WIQL of a saved query created in TFS

I have created a query in TFS interactively using the web interface. Now I want to get the WIQL that it is using.

The only way I know how is to call the RESTful api, and pass $expand=wiql. Is there an easier way? Ideally from the interactive web interface?

Upvotes: 4

Views: 3696

Answers (2)

Funkpotamus
Funkpotamus

Reputation: 106

You can use Chrome's "Developer Tools" (under "More Tools") click the Network tab and run the TFS query. You'll see the query item in the list of items. Click on the query item and you'll see the WIQL code in the view pane.

Example: enter image description here

Upvotes: 9

DaveShaw
DaveShaw

Reputation: 52818

Doesn't seem like you can do it in the Web Access. You can however do it in Visual Studio (if you have it).

Open the Query and then Edit it, now if you do File, Save as... you can then save the query as a .wiq XML file, that will include the WIQL:

save as dialog

Example content:

<?xml version="1.0" encoding="utf-8"?>
<WorkItemQuery Version="1">
    <TeamFoundationServer>https://----.visualstudio.com/defaultcollection</TeamFoundationServer>
    <TeamProject>Test Agile</TeamProject>
    <Wiql>SELECT [System.WorkItemType], [System.Title], [System.State], 
    [Microsoft.VSTS.Scheduling.StoryPoints], [System.IterationPath], [System.Tags] 
    FROM WorkItemLinks 
    WHERE Source.[System.WorkItemType] in group 'Microsoft.RequirementCategory' 
</WorkItemQuery>

Upvotes: 5

Related Questions