TFS API Part 6: WorkItemStore – Get Fields From WorkItemType

19/01/2009

one comment

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

Add comment
facebook linkedin twitter email

Leave a Reply

one comment

  1. Plastic mold05/02/2010 ב 11:24

    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!