Search code examples
javascriptazure-devopsazure-devops-extensions

How to retrieve work items from Azure DevOps extension?


I successfully followed Microsoft's tutorial to create an extension.

I'm trying to get all the work-items of certain sprint, but to be honest, I'm lost...

I'm not sure what to look for - I have the VSS object, with which I can require additional services (such as TFS/WorkItemTracking/Services or TFS/WorkItemTracking/RestClient).

I found some examples like this one, but couldn't find an API to retrieve or query work items.

Do I need a JS object for that, or is it accomplished via some REST call?


Solution

  • To query work items, you can can also check this page for WorkItemTrackingHttpClient2_2 client API.

    IPromise<Contracts.WorkItemQueryResult> queryById(id, project, team)
    
    IPromise<Contracts.WorkItemQueryResult> queryByWiql(wiql, project, team)
    

    This is also an example about how to get WorkItemTrackingHttpClient and to call Api on Microsoft docs site.