I wanted to access TFS data via TFS API and WIQL using a custom field in WIQL where clause:
string wiqlQueryDoorsProxy =
"Select * from WorkItems where ([Work Item Type] = 'DoorsProxy' AND [Object Id] = '\" + requirementId + "\')";
where [Object Id] is the custom field. But TFS API gave exception message:
"TF51005: The query references a field that does not exist. The error is caused by «[Object Id]»."
The field definition has name = "Object Id" and reference name = "DoorsTool.DoorsArtifactType.ObjectId". I tried both Object Id and DoorsTool.DoorsArtifactType.ObjectId in the WIQL. Same result.
I changed the code as follows and it worked perfectly:
string wiqlQueryDoorsProxy ="Select * from WorkItems where ([Work Item Type] = 'DoorsProxy' )";
WorkItemCollection witCollectionDoorsProxy = wiStore.Query(wiqlQueryDoorsProxy);
foreach (WorkItem workItemDoorsProxy in witCollectionDoorsProxy)
{
workItemDoorsProxy.Open();
if (workItemDoorsProxy.Fields["Object Id"].OriginalValue.ToString() == requirementId)
{
...
}
}
But now the performance is bad.
What can I do. The problem looks similar to this but still I cannot solve the problem based on that discussion.