You could try the rest api: [Classification Nodes - Get Classification Nodes][1].
For example, this is the project iteration and team iteration
[![enter image description here][2]][2]
Then you could run the api with the filter '$depth', here in my sample it should be 2: To get the draft information of the project iteration and team iteration(inclue their id).
Get https://dev.azure.com/{org name}/{project name}/_apis/wit/classificationnodes?$depth=2&api-version=5.0
[![enter image description here][3]][3]
And if you want to get more specific information about the project iteration, you could try to run with the filter 'id':
Get https://dev.azure.com/{org name}/{project name}/_apis/wit/classificationnodes?ids=**&api-version=5.0
[![enter image description here][4]][4]
And for your reference, I use postman to run rest api, it seems you could choose language here:
[![enter image description here][5]][5]
I hope it could do some help. Thanks.
[1]: https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/classification-nodes/get-classification-nodes?view=azure-devops-rest-5.0&tabs=HTTP#get_the_iteration_tree_with_2_levels_of_children
[2]: https://i.stack.imgur.com/GWtvU.png
[3]: https://i.stack.imgur.com/xElRU.png
[4]: https://i.stack.imgur.com/InUmH.png
[5]: https://i.stack.imgur.com/eTalz.png