Query work items by type (e.g. Task)
Returns work items of a given type (e.g. Task, Bug, User Story) by filtering with a WIQL query on System.WorkItemType. Use this to list all tasks, all bugs, or any other type. You can combine with other WIQL conditions (state, project, dates) in the same query string.
SELECT * FROM WorkItems WITH (Query='SELECT * FROM WorkItems WHERE [System.WorkItemType] = ''Task''')