How To Access Work-Item(s) From Team Foundation Server 2018

At the point when you have various groups and each group creates loads of code as a feature of their expectations, dealing with the code with no appropriate apparatus is a difficult assignment particularly in a light-footed venture the board cycle. Monitoring every form is an overwhelming undertaking in such situations. There is a shot at everything can go haywire right from forming, coordination, till definite conveyance.

With Team Foundation Server (TFS) you can say farewell to all problems. TFS is a top Microsoft item for overseeing source code. With TFS (5 fundamental records are free) you can oversee projects for both cascade and coordinated styles. Prerequisite administration, computerized assembles, testing and delivery the executives capacities, and lab the board gets straightforward with TFS. You can likewise utilize TFS as back-finish to different advancement conditions (IDEs). Be that as it may, you can just utilize TFS for Microsoft Visual Studio just as Eclipse on all stages.

This blog gives you a stroll through on the best way to get to work things in TFS.

There are various approaches to get to work things in TFS. One of them is TFS API call and another is WIQL (Work Item Query Language). We will examine WIQL in this blog.


To beat such issues TFS API is exceptionally helpful as it gives numerous approaches to get and oversee (update/erase) those work things and sync them with their Project the board instrument. This can be useful in saving valuable time and asset.

1. Beginning with TFS

Assuming you haven’t enrolled with Microsoft, first you need to enlist to go on. You can make another one either by utilizing your own email address or by making new email address ( ).

In the wake of signing into, we need to make another record on which every one of our tasks will be facilitated. We will utilize ‘WorkItemDemo’ ( as the name of record. Additionally, we will utilize ‘Group Foundation Version Control’ to oversee code for this account.

At the point when you will tap on ‘change subtleties’ it will give 3 info boxes to change following subtleties:

2. Make new Project

When another record is effectively made, another undertaking will likewise be made alongside it. Of course, the undertaking name will be ‘MyFirstProject’ which can be renamed.

We should make some new assignments in ‘MyFirstProject’ project first: (these new errands will be known as TFS API or WIQL in the later stages)

1) From dashboard float on Work (Menu thing) > New Work Item > TaskCreate new Project

2) ‘New Task’ popup will open. Enter every one of the necessary subtleties in separate fields and afterward click on Save and Close catch. Follow a similar interaction to make not many more errand work items.

3. Individual Access Token

To get to all work thing related subtleties from TFS API, we will make PAT (Personal Access Token) for verification.

  • Sign in to your TFS account.
  • From Profile (on upper right corner), click on Security.Personal Access Token
  • Make an individual access token by tapping on ‘Add’ button.Personal Access Token — Add
  • Enter every one of the necessary subtleties and afterward click on ‘Make Token’ button.
  • Ensure you duplicate the recently made token as you will not have the option to see it once more. What’s more, store it’s anything but a protected spot as it very well may be dangerous in the event that it goes into wrong hands.

4. Essential for making Work Items

Following focuses should be satisfied prior to beginning into coding:

  • TFS account.
  • Individual Access Token (PAT)
  • Undertaking having Work Items
  • Visual Studio

5. Getting Work Items from TFS

Post making TFS account, Project, Task things, PAT, and so on we should bring the rundown of undertaking things in our code.

Getting Work Items by utilizing Work Item Query Language (WIQL)

In the above technique code, constructor “ExecuteQuery()” relegate some significant qualities like URI, PAT, Project name which should be questioned for getting rundown of work things.

In code strategy “RunGetWorkItemsQueryUsingClientLib()”, following code characterizes the inquiry which will choose “State” and “Title” of work things. Likewise, it characterizes that lone specific task will be questioned for getting the outcome which was characterized in constructor technique. Same with condition of the work thing that solitary those work things will be gotten whose state isn’t equivalent to ‘Closed’.RunGetWorkItemsQueryUsingClientLib()

Following code fires the question which is put away in factor named as ‘Inquiry’ in past picture and the consequence of the question will be allocated in ‘workItemQueryResult’.

Finishing code will circle the ‘workItemQueryResult’ variable and repeat on every single thing to get the subtleties of work thing returned by query.workItemQueryResult


Originally published.

Gravelsoft provides software solutions and solve client’s business challenges by providing expert software engineering and consultancy services.