Azure devops 此端点将允许您查看它是否在前一个sprint中,以及它是否在当前sprint中关闭。但是查询变得复杂了…(这就是我现在所处的位置).祝你好运!我确实使用了,但是如果sprint超过,它仍然有它的限制,在我的例子中是2周。通过使用查询,是否还有其他类似的操作

Azure devops 此端点将允许您查看它是否在前一个sprint中,以及它是否在当前sprint中关闭。但是查询变得复杂了…(这就是我现在所处的位置).祝你好运!我确实使用了,但是如果sprint超过,它仍然有它的限制,在我的例子中是2周。通过使用查询,是否还有其他类似的操作,azure-devops,azure-boards,Azure Devops,Azure Boards,此端点将允许您查看它是否在前一个sprint中,以及它是否在当前sprint中关闭。但是查询变得复杂了…(这就是我现在所处的位置).祝你好运!我确实使用了,但是如果sprint超过,它仍然有它的限制,在我的例子中是2周。通过使用查询,是否还有其他类似的操作:创建date@awk1912您可以在WIQL查询中简单地进行过滤,如create date


此端点将允许您查看它是否在前一个sprint中,以及它是否在当前sprint中关闭。但是查询变得复杂了…(这就是我现在所处的位置).祝你好运!我确实使用了,但是如果sprint超过,它仍然有它的限制,在我的例子中是2周。通过使用查询,是否还有其他类似的操作:创建date@awk1912您可以在WIQL查询中简单地进行过滤,如
create date
,例如,您只需要添加另一个过滤器r条件
和[System.CreatedDate]<'2019-10-10'
,请参阅更新的答案。
Param(
   [string]$baseurl = "https://dev.azure.com/{organization}", 
   [string]$projectName = "project name",
   [string]$user = "username",
   [string]$token = "password/PAT"  
)

# Base64-encodes the Personal Access Token (PAT) appropriately
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))


# Query the work items with wiql
$uri = "$baseurl/$($projectName)/_apis/wit/wiql?api-version=5.1"


function CreateJsonBody
{
    $value = @"
{
  "query": "Select [System.Id], [System.Title], [System.State],[System.Tags] From WorkItems Where [System.WorkItemType] = 'User Story' AND [System.State] <> 'Closed' AND [System.State] <> 'Removed' AND [System.IterationPath] = @currentIteration('[Agile-0219]\Agile-0219 Team') order by [System.CreatedDate] desc"
}

"@
 return $value
}
$json = CreateJsonBody

#Get the urls for WIs
$queryresult = Invoke-RestMethod -Uri $uri -Method POST -Body $json -ContentType "application/json" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}

$wiurls = $queryresult.workItems.url


#Filter the work items which carried from other iterations to current iteration
$wis = @()
cls
foreach($wiurl in $wiurls){

#Set the work item revision URL
$revurl = "$wiurl/revisions"

$wi = (Invoke-RestMethod -Uri $revurl -Method GET -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)})

#Detect the Unique iterations which the work item ever been involved  
$iterationcount = ($wi.value.fields.'System.IterationPath'|select -Unique).count
#write-host $iterationcount

if ($iterationcount -gt 1) # Filter the work items which moved from other iterations
    { 
      # Select the latest revision 
       $wilatest = ($wi.value | Select -last 1) 

        $customObject = new-object PSObject -property @{
          "WitID" = $wilatest.id
          "Title" = $wilatest.fields.'System.Title'
          "AssignedTo" = $wilatest.fields.'System.AssignedTo'.displayName
          "ChangedDate" = $wilatest.fields.'System.ChangedDate'
          "ChangedBy" = $wilatest.fields.'System.ChangedBy'.displayName
          "WorkItemType" = $wilatest.fields.'System.WorkItemType'
          "State" = $wilatest.fields.'System.State'
          "URL" = $wilatest.url
        } 

    $wis += $customObject   
    }

}
    $wis | Select-Object `
                WitID,
                Title, 
                AssignedTo,
                ChangedDate, 
                ChangedBy,
                WorkItemType,
                State,
                URL #|export-csv -Path D:\sample.csv -NoTypeInformation
"Select [System.Id], [System.Title], [System.State],[System.Tags] From WorkItems Where [System.WorkItemType] = 'User Story' AND [System.State] <> 'Closed' AND [System.State] <> 'Removed' AND [System.IterationPath] = @currentIteration AND [System.CreatedDate] < '2019-10-10' order by [System.CreatedDate] desc"