I am new to TFS and powershell scripting.As a part of my assignment I got a task in which
I have an array with TFS workitem ID's and I need to loop through and get the details of those id's and display the result.
As a part of it I tried as shown below
$TFSSERVER = "https://server"
$WId = @("1", "2", "3", "4")
$arr = @("")
$i = 0
Function Get-WorkItemData($WId)
{
foreach($Id in $WId)
{
$i++
$query = "SELECT [System.Id]
FROM WorkItemLinks " +
"WHERE [Source].[System.id] = $Id" +
"AND [System.Links.LinkType] = 'Parent'"
if($WId.length -ge $i)
{
$arr+= $query
}
}
$wiData = tfpt query /collection:$TFSSERVER /wiql:$arr
$wiData | out-file "C:\Path"
}
Here is the error i get when i run the script
TFPT.EXE : Expecting end of string. The error is caused by ½SELECT╗. At line:28 char:22 + $wiData = tfpt <<<< query /collection:$TFSSERVER /wiql:$b + CategoryInfo : NotSpecified: ( Expecting end ...ed by ½SELECT╗.:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError
Can anyone please help me to how to resolve the error and get list of all details. Please help me.