[英]How to list out the work items under a team in azure devops
我使用下面的 http 請求成功地獲取了項目下的工作項。
http://dev.azure.com/{organization}/{project}/_apis/wit/reporting/workitemrevisions?includeLatestOnly=true&api-version=5.0-preview.2
同樣,我需要獲取團隊工作項,這是我使用的請求。
http://dev.azure.com/{organization}/{project}/{team}/_apis/wit/reporting/workitemrevisions?includeLatestOnly=true&api-version=5.0-preview.2
但是,我沒有得到工作項。 誰能幫我語法。
您可以通過以下方式獲取團隊任務板上的工作項目:
GET https://dev.azure.com/{organization}/{project}/{team}/_apis/work/taskboardworkitems/{iterationId}?api-version=6.0-preview.1
並在團隊迭代中:
GET https://dev.azure.com/{organization}/{project}/{team}/_apis/work/teamsettings/iterations/{iterationId}/workitems?api-version=6.0-preview.1
您還可以執行 WIQL 查詢:
$AreaPath = "{Project}\{PathYou'reInterestedIn}"
# Example WIQL gets all User Stories and Bugs that are not removed
$wiql = @"
SELECT
[System.Id]
FROM workitems
WHERE
[System.TeamProject] = '$($AreaPath.Split("\")[0])'
AND [System.AreaPath] UNDER '$($AreaPath.Replace("\", "\\"))'
AND [System.State] <> 'Removed'
AND [System.WorkItemType] IN ('User Story', 'Bug')
ORDER BY [System.ChangedDate] DESC
"@
$uri = "https://dev.azure.com/{org}/_apis/wit/wiql?api-version=6.1-preview.2"
# add your access token to the headers
$headers = @{ Authorization = "Basic " + + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$YourAccessTokenValue"))
# I wrote the WIQL to be readable - this makes it suitable for a JSON request
$query = @{ query = ($wiql.split([System.Environment]::NewLine) | `
ForEach-Object { "$($_.Trim())" }) -join " " } | `
ConvertTo-Json
$workItemList = (Invoke-RestMethod -Uri $uri -Headers $headers -Method Post -Body $query).workItems
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.