Search code examples
azure-devopsazure-devops-rest-apiazure-devops-extensionsazure-devops-server-2019

Azure Devops Analytics Work Item Query with Team Id


Is it possible to query the _odata end point for work items and get the actual team id that the work items are assigned to? I can expand the Teams navigation property but that just gives me a list of all project teams, not the team that the work item belongs to

https://analytics.dev.azure.com/{organization_name}/_odata/v3.0-preview/WorkItems?select=WorkItemId,Title,WorkItemType

Solution

  • I can expand the Teams navigation property but that just gives me a list of all project teams, not the team that the work item belongs to

    What is the full URL of the OData you are using?

    The OData URL you shared seems is not the full.

    https://analytics.dev.azure.com/{organization_name}/_odata/v3.0-preview/WorkItems?select=WorkItemId,Title,WorkItemType
    

    I also try expand the teams in the query and it can correctly display the teams which the work items are owned by.

    The following is the full URL of the OData I test on Postman:

    https://analytics.dev.azure.com/{OrganizationName}/{ProjectName}/_odata/v3.0-preview/WorkItems?$select=WorkItemId, WorkItemType, Title, State, TagNames&$expand=AssignedTo($select=UserEmail), Area($select=AreaPath), Iteration($select=IterationPath), Teams($select=TeamName)&$filter=(Area/AreaPath eq '{AreaPath}')
    

    Result: enter image description here

    If the area path of the work item has been assigned to multiple teams, in the Teams object, it will list all the teams which the area path is assigned to. enter image description here