Using the following docs, https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/Work%2520Items/List?view=azure-devops-rest-5.0&viewFallbackFrom=vsts-rest-5.0, I have an api call that gets a list of workitems.
I convert that to Json in my devops build yml via a powershell script but looping through the "value" array doesn't seem to print anything to my devops console. Any help on syntax?
$jsonResp = $($workItemResponse | ConvertTo-Json -Depth 100)
Write-Host "json formatted response"
Write-Host $jsonResp.value
foreach($item in $($jsonResp.value))
{
$releaseNotesHtml += "<div>" + $item.fields.System.Id + "</div>"
Write-Host $item.fields.System.Id
Write-Host $item.fields.System.Title
Write-Host $item.fields.System.State
Write-Host $item.fields.System.Description
}
I've also tried this, with no success.
foreach($item in $jsonResp.value)
{
$releaseNotesHtml += "<div>" + $item.fields.System.Id + "</div>"
Write-Host $item.fields.System.Id
Write-Host $item.fields.System.Title
Write-Host $item.fields.System.State
Write-Host $item.fields.System.Description
}