DCSIMG
TFS API Part 6: WorkItemStore - Get Fields From WorkItemType - Shai Raiten's Blog

Shai Raiten's Blog

It's all about code...

TFS API Part 6: WorkItemStore - Get Fields From WorkItemType

TFS API Part 6: WorkItemStore - Get Fields From WorkItemType

In TFS API Part 5: WorkItemStore - Get Project Details (WorkItemTypes, Queries) we use WorkItemStore to get all work item type from TFS.

In this post I’ll show how to take all fields for a specific Work Type.

First add reference for Microsoft.TeamFoundation, Microsoft.TeamFoundation.Client, Microsoft.TeamFoundation.Common.dll,Microsoft.TeamFoundation.WorkItemTracking.Client.dll
located in - C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\

Download Demo Project

using Microsoft.TeamFoundation.Proxy;

using Microsoft.TeamFoundation.Client;

using Microsoft.TeamFoundation.Server;

using Microsoft.TeamFoundation.WorkItemTracking.Client;

Connect to TFS (TFS API Part 1: Domain Picker)

from Work Item type you can get FieldDefinition.

    public class WitType

    {

        public WorkItemType Type { get; set; }

        public List<string> Fields { get; set; }

 

        public WitType(WorkItemType type)

        {

            this.Type = type;

            this.Fields = new List<string>();

 

            foreach (FieldDefinition f in Type.FieldDefinitions)

                Fields.Add(f.Name);

        }

 

        public override string ToString()

        {

            return Type.Name;

        }

    }

 

1 2

Download Demo Project

Comments

Team System News said:

Neno Loje on Download: Visual Studio 2008 Project Template for TFS Utilities The NorthWest Cadence Blog

# January 21, 2009 5:37 PM

Plastic mold said:

I tried to think so, but I found it was not as the same in the actual process. As you mentioned, I still have doubts, but really thank you for sharing!

# February 5, 2010 11:24 AM

Shai Raiten said:

TFS API Part 24 – Get All Fields From TFS I got an email regarding previous post ( TFS API Part 6: WorkItemStore

# March 9, 2010 11:06 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: