6

I'm building a Widget in VSTS and I'm calling the queryByWiql() method from Work Item Tracking rest client.

The query I have is:

queryString = {
    "query": "Select [Microsoft.VSTS.Scheduling.RemainingWork]
     From WorkItems
     Where [System.WorkItemType] = 'Task'
     AND [System.State] <> 'Done'
     order by [System.CreatedDate] desc"
};

But the result looks like this, where none of the work item actually contain the Remaining Work Information:

enter image description here

This is true for any fields I request; Title, State, Assigned To etc. The fields I've requested will appear under columns. But none of the work items themvselves will have the information.

Why is this the case? And how can I fix it? Cheers

davidx1
  • 3,525
  • 9
  • 38
  • 65

1 Answers1

4

This is an expected behavior. Currently, there is no way to call the API to return the detailed work item information from a WIQL query directly. You need to get these information in two steps:

  1. Get the ID of the work items from a WIQL which you have done.
  2. Get these work items via Get a list of work items by ID. And you can specify the field to get at this step.

Instruction on WIQL Query page:

After executing a query, get the work items using the IDs that are returned in the query results response. You can get up to 200 work items at a time.

Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60
  • 3
    "This is expected behaviour", and yet there is no mention of this anywhere on your page here: https://learn.microsoft.com/en-us/rest/api/vsts/wit/wiql/query%20by%20wiql?view=vsts-rest-4.1 _In fact_, it states in part 2 that it's possible to send a query of some sort and get the data back from the query, but there's no mention of the POST body needed to do this! – Elven Spellmaker May 28 '18 at 16:57