ddee

Hello,

I am working with TFS using ASP.NET, c#. I would like to get Data from TFS for those work item depend on workitem type is bug, Scenario, task, ...

State ( Active, Closed...),

Type (API, High level Requirement, Security...),

Triage (Approved, Investigate..),

Priority(1,2...), Severity(Critical, high,...),

discipline (Architecture, development...).

Is there any API to do this or is there a way to do this at all Please help!

Any answer would be greatly appreciated. Thanks in advance.

Ddee



Re: Team Foundation Server - Work Item Tracking How to get data From TFS Work Item field!

Vic Tang - MSFT

Have you checked Naren's blog on using WIT Object Model http://blogs.msdn.com/narend/archive/2006/09/15/756158.aspx that should give you some OM code to started with. As for getting fields for specific workitemtypes, you can create a query with WorkItemType='Bug' and run the query through OM. I am not sure If I have answered you questions. Just let us know.

thanks

Vic 





Re: Team Foundation Server - Work Item Tracking How to get data From TFS Work Item field!

ddee

Thank you for your reply.

I checked the website and it definitely gave me the idea of how to work on my problem But I can not find the some of the work item field definition like Requirement Type,.. the corefield doesnt have Type in there.... Can you tell me where/how to find the correct field name for it... thanks

Ddee





Re: Team Foundation Server - Work Item Tracking How to get data From TFS Work Item field!

ddee

Hi Vic,

To be more specific, I try to do this:

wiTypeLB.DataSource = m_store.Projects["Projectname"].WorkItemTypes["Requirement"].FieldDefinitions["RequirementType"].AllowedValues;

this is the error i got:

TF26027: A field definition RequirementType in the work item type definition file does not exist. Add a definition for this field, or remove the reference to the field and try again..

How do I find the list of fields definition

Thanks

ddee





Re: Team Foundation Server - Work Item Tracking How to get data From TFS Work Item field!

Kathirvel

Hi,

The system fields i.e [Core Fields] can be only accessible when your offline i.e you are not connected to the TFS and any project. The field you are referring is MIGHT be i am not sure what you ar using ..but assuming this is the Custom field and those fields CAN'T be accessible through the code. So just try the Core Fields like "System.Area" ..you will be able to get the values...

The same i also tried long back but i don't know how to get the CUSTOM field definition and its values PROGRAMMATICALLY. Let's see is anybody replying to this query...

Thanks,
Kathir





Re: Team Foundation Server - Work Item Tracking How to get data From TFS Work Item field!

ddee

hi

the Field "type" is not a custom field...It is from TFS ... Please look at the below:

The Work Item Dimension

The following tables describe the common attributes that are included in the Work Item dimension. This dimension contains all attributes of all work items that are deployed on the Team Foundation Server computer. Every work item definition contains a set of common fields, and these fields are always attributes in the Work Item dimension.

Attribute Origin Description

ID

Common

The identification number of the work item, as assigned when the work item was created.

Work Item Type

Common

The type of work item.

Title

Common

The title of the work item.

State

Common

The state of the work item.

Previous State

Common

The previous state of the work item.

Reason

Common

The reason that the state of the work item changed.

Rev

Common

The revision of the work item.

Activated By

MSF

The person who activated the work item.

Blocked

CMMI

Whether the work item is blocked from being completed.

Closed By

MSF

The person who closed the work item.

Discipline

MSF

The discipline to which the task belongs.

Exit Criteria

MSF

The flag to determine whether this scenario should be tracked as an exit criteria for the iteration.

Issue

MSF

Used to highlight the work item, for example, to mark a bug as an issue.

Rough Order of Magnitude

Agile

A rough estimate of the number of person-days to complete the task.

Priority

CMMI

Priority to the business.

Quality of Service Type

Common

The Quality of Service type.

Rank

MSF

Stack rank to prioritize work

Requirement Type

CMMI

The type of the requirement.

Resolved By

MSF

The person who resolved the work item.

Resolved Reason

MSF

The reason why the bug was resolved.

Task Hierarchy

MSF

A string representing Microsoft Project context for the given work item.

Task Type

CMMI

The type of task.

Triage

CMMI

Status of triaging the work item.





Re: Team Foundation Server - Work Item Tracking How to get data From TFS Work Item field!

Kathirvel

That's fine ...i agree with that ..what i meant was only SYSTEM i.e CORE Fields can be accessible through code....and all other fields ie ..Microsoft.VSTS.Common or anything related to CMMI also can't accessible through code ...as far as now and upto my knowledge. pardon me if i am wrong.....since we also try to get Microsoft fields but we couldn't.....that's i meant....

i shouldn't used the word as "CUSTOM"...that's y lit bit confusion ....and i am not sure what you have used....ok...NOW i am clear ...you are trying the Microsoft fields...defined ......

wht ever other than SYSTEM fields...none of the fields can be accessible programmatically......





Re: Team Foundation Server - Work Item Tracking How to get data From TFS Work Item field!

ddee

Sorry Kathirvel... I was misunderstand about the custom field that you mention... Thanks for your explaination.

I hope someone in the forum can have the answers for us of how ( or is it possible) to get those cmmi field of common field thru code.

Thanks,

ddee





Re: Team Foundation Server - Work Item Tracking How to get data From TFS Work Item field!

James Manning - MSFT

You can reference it by the display name ("Requirement Type", with the space) or the reference name ("Microsoft.VSTS.CMMI.RequirementType"). "RequirementType" matches neither, so you get that error from the Item indexer.

In terms of finding the available field definitions, you can just iterate over the collection (FieldDefinitions) - the Name and ReferenceName properties are the values you can index by into the collection.





Re: Team Foundation Server - Work Item Tracking How to get data From TFS Work Item field!

James Manning - MSFT

In terms of "exploring" the object model like this, I heavily recommend PowerShell.

You can use get-tfs.ps1 to get the top-level object and then expore from there.

http://blogs.msdn.com/jmanning/archive/2006/09/28/776141.aspx

$tfs = get-tfs http://yourserver:8080
$tfs.wit.Projects['Projectname'].WorkItemTypes['Requirement'].FieldDefinitions |
ft name, referencename, {$_.allowedvalues}





Re: Team Foundation Server - Work Item Tracking How to get data From TFS Work Item field!

zzonmsdn

hello

  1. Getting Work Items
public WorkItem GetWorkItem(int id)

every revision of a work item is stored so that users can also get
work items as of a specific date/time or revision index

eg: public WorkItem GetWorkItem(int id, DateTime at)

  1. to manipulating Work Items
public WorkItem(WorkItemStore store, WorkItemType type)
The Fields, Links, and Attachments collections of a WorkItem can be
viewed and edited. Once any edits are made to these parts of a
WorkItem, the work item is marked as dirty via the IsDirty property.

regards
zaher





Re: Team Foundation Server - Work Item Tracking How to get data From TFS Work Item field!

ogiepogi

hi,
this might help:

WorkItemStore wrkStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
WorkItem wrkItm = wrkStore.GetWorkItem(wrkItemId);
object customField1 = wrkItm.Fields["Microsoft.Customize.CustomField1"].Value;