Search code examples
powershellazure-devopsazure-devops-rest-api

Azure Devops RestAPI returns max 2 levels of queryfolders


I want to be able to make a table regarding queries with 'name','id','url' properties in an Azure Devops Project. These queries are sometimes located in a folderstructure more than 3 levels deep. Rest-api (using Powewrshell) doesn't let me go that deep. Is there an alternative? Structure of folders is:

enter image description here

I tried the Azure Devops Restservices manually, using a browser and using a Powershell script. But it only shows "My Queries"and "Shared Queries" and one level below those. The output of: https://dev.azure.com/{Organization}/{Project}/_apis/wit/queries?&$depth=2&api-version=7.1-preview.2 Result: it Only goes to level 2 (2nd Level Folder is shown, not deeper than that).

I hope there is an alternative, or else restructure the folder hierarchy....


Solution

  • This is because other folders in the children section:

    enter image description here

    To get the next level, you may add the needed path to URL: https://dev.azure.com/{org}/{project}/_apis/wit/queries/Shared Queries/Current Iteration?&$depth=2&api-version=7.1-preview.2

    enter image description here