# TFS Work Item Query

**URL:** https://www.finalbuilder.com/forums/t/tfs-work-item-query/1722
**Category:** Discussion
**Created:** [March 17, 2011, 5:03am UTC](https://www.finalbuilder.com/forums/t/tfs-work-item-query/1722 "2011-03-17T05:03:55Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![garthbf](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/g/77aa72/32.png) [@garthbf](https://www.finalbuilder.com/forums/u/garthbf)
#### Post date: [March 17, 2011, 5:03am UTC](https://www.finalbuilder.com/forums/t/tfs-work-item-query/1722/1 "2011-03-17T05:03:55Z")

</div>

I am doing a query with the tfs work item query action and get the followning error.  
what am I doing wrong or does it not support this?

Querying for work items...  
Connecting to server 'http://tfsdev:8080/tfs/defaultcollection' using current credentials...  
Authenticating...  
Work item query : SELECT [System.Id], [System.Links.LinkType], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State]   
FROM WorkItemLinks   
WHERE ([Source].[System.TeamProject] = @project&nbsp;   
AND&nbsp; [Source].[System.WorkItemType] = 'Product Backlog Item'&nbsp;   
AND&nbsp; [Source].[System.State] = 'Committed')   
And ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Reverse')  
And ([Target].[System.WorkItemType] = 'Sprint'&nbsp;   
AND&nbsp; [Target].[System.Id] = 166) ORDER BY [System.Id]   
mode(MayContain)  
Could not execute query : TF248021: You have specified a query string that is not valid when you use the query method for a flat list of work items. You cannot specify a parameterized query or a query string for linked work items with the query method you specified.  
&nbsp;

Thanks,

Garth

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [March 21, 2011, 1:00am UTC](https://www.finalbuilder.com/forums/t/tfs-work-item-query/1722/2 "2011-03-21T01:00:10Z")

</div>

Hi Garth,   
 It seems that hierarchical queries are not supported by the API call FinalBuilder is making to TFS (WorkItemStore.Query).   
  
 From what I can tell, in order to do what you’re after you need to run a series of specific queries based on which work items you want. Unfortunately as this is very dependent on your situation it doesn’t make sense for us to create a FinalBuilder action for it, or to modify the existing action.   
  
 These links may help if you decide to write your own API calls:   
 [http://archive.msdn.microsoft.com/TfsSdk/Thread/View.aspx?ThreadId=3517](http://archive.msdn.microsoft.com/TfsSdk/Thread/View.aspx?ThreadId=3517)   
 [http://social.msdn.microsoft.com/Forums/is/tfsworkitemtracking/thread/74398c8d-74cd-4bbf-80c9-4ad7ab925d65](http://social.msdn.microsoft.com/Forums/is/tfsworkitemtracking/thread/74398c8d-74cd-4bbf-80c9-4ad7ab925d65)   
  
 Sorry I couldn’t be more help.   
  
 Ben
