how to get Task,Feature id,completed hours by date.
lets say there is a
task 123 in which was created on a sprint which start date is 1st July and end at 10th July
Based on your description, seems you want to get the history (revisions) for a specific work item.
If it is, then you can use the REST API to retrieve that: See Get a list of work items revisions
GET https://{instance}/DefaultCollection/_apis/wit/workitems/{id}/revisions?api-version={version}[&$top={int}&$skip={int}&$expand={enum{relations}
Try below sample to filter the list by date:
Param(
[string]$collectionurl = "http://172.17.16.115:8080/tfs/DefaultCollection",
[string]$witid = "12",
[string]$user = "username",
[string]$token = "password"
)
# Base64-encodes the Personal Access Token (PAT) appropriately
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))
$baseUrl = "$collectionurl/_apis/wit/workitems/$witid/revisions?"+"$"+"expand=all"
$response = (Invoke-RestMethod -Uri $baseUrl -Method Get -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}).value
# Filter the revisions changed between the date '2018-07-01'and '2018-07-05' and remaining work >=O
$revisions = $response | where({$_.fields.'System.ChangedDate' -ge '2018-07-01' -and $_.fields.'System.ChangedDate' -le '2018-07-06' -and $_.fields.'Microsoft.VSTS.Scheduling.RemainingWork' -ge '0' } )
$witrevisions = @()
foreach($revision in $revisions){
$customObject = new-object PSObject -property @{
"WorkItemType" = $revision.fields.'System.WorkItemType'
"WorkItemID" = $revision.fields.'System.Id'
"Revid" = $revision.rev
"RemainingWork" = $revision.fields.'Microsoft.VSTS.Scheduling.RemainingWork'
"Relations" = $revision.relations.url
"ChangeddDate" = $revision.fields.'System.ChangedDate'
}
$witrevisions += $customObject
}
$witrevisions | Select-Object `
WorkItemID,
WorkItemType,
Revid,
RemainingWork,
Relations,
ChangeddDate #| export-csv -Path E:\filename.csv -NoTypeInformation