index > Team Foundation Server - Work Item Tracking > Getting WorkItems by Project Name from TfsWorkItemTracking databa...

Getting WorkItems by Project Name from TfsWorkItemTracking databa...


Hi all,

I would like to retrieve the list of work items from TfsWorkItemTracking database because of some reason, The only why i'm able to find out is to get all the Areas from TreeNodes table and then get WorkItems based on Area but it involves recursively retrieval of Areas, is there any other path to it?

why i'm saying project name in the title coz i wanted to retrieve them by project, and which is now i know i can do it via top most area from TreeNodes as its same as the project name and u cant rename it as well :).

regards
faraz
Faraz_Ahmed

Hello Faraz,

I am assuming you are using WorkItem Object Model to get the work items. One easy way to get the work items in each project would be

WorkItemStore

Smitha S Saligrama
thanks for the reply, but no as i mentioned i'm retrieving it from TfsWorkItemTracking database, so i'v to use sql for that coz i'v to update one field of all the workitems of a particular proj coz of some reason..i'v already done it in warehouse but workitem database is remaining and after analyzing the tables, i'm not able to figure out except the way i'v mentioned in my last post.. so i'm looking something straight..

regards
faraz

Faraz_Ahmed

Hi,

This is a worst pratice, you should consider the TFS Databases like "Black Box". Data Schema could be updated in the futures versions and a lot of your code would not work anymore.

You should only ask TFS server using the API.

mathieu.szablowski
I totally agree with you, and i know it very well.. but the situation i'v, its first of all one time issue.. 2ndly its just a one field i wana change which is just a value type.. if u wana know i can explain u the scenario why i wana do this...but if there is no solution other then recursive query.. :)

regards
faraz
Faraz_Ahmed
Yes, can you explain your scenario on why you need to access database directly to update field values? You can update fields using our object model for all work items in server and that is the approach we recommend.


http://blogs.msdn.com/narend
Naren Datha - MSFT
hmm, the change is just one time.. its in a value type column, so i thought instead of writing code i shuld just update the column values thats it.. the column is our own custom one with combo selected values, and we have updated value list, so wanted to update existing project's workitmes. :)

regards
Faraz_Ahmed

Updating values in database is tricker than it seems. Here are some questions to think about: If you do update the value, do you expect it to be updated only on latest revision or on all old revisions? If you update it on specific existing revision, during auditing it seems as if the actual user who created the revision added that value when in fact an admit directly changed the db. Sometimes we do cache strings and place ids in table to reduce data size, in which case it is tricky to get the string id. For various reasons like this, changing data directly is discouraged and will void support.

You can update fields of many items easily by exporting into excel and then bulk changing field values, it requires no coding.




http://blogs.msdn.com/narend
Naren Datha - MSFT
well agreed, this is the only fear i had as well, coz i explored workitemtracking database and it had lots of different things in it.. but yeah i'v updated all the versions "Latest,Are and Were", and before that i did checked it on our RnD TFS, it worked fine so i did in the production server as well.. anyway.. i know its bad.. but its done now :) .. but yeah..i totally forgot excel as TFS client.. and found it the easiest way to do it.. anyway thanks alot..i'v marked ur last reply as answer :)
Faraz_Ahmed
reply 9

You can use google to search for other answers

 

More Articles

File type missing when added file attachment to scenario work ite...
Can a work item type be deleted in VSTS?
Query for attachments
MS Project synchronization
Work Item custom field's value update
TFS RC: Error loading Microsoft.TeamFoundation.WorkItemTracking.S...
Appending data to a work item field as opposed to COPY
Added fields and mapping changes
Work Item Update Collisions
Custom alerts and inability for Daily/Weekly delivery options...
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Unable to publish new project tasks
How to create query with filter "Re…
Bug -> Details -> Found in build
Master/sub-project support across TFS pr…
Project->Tasks: bogus start dates?
Strange Problem --- SQL Server 2005 and …
Migrating From Other Bug Tracking System…
Exception using TFS client in Web App
How to implement AssignTo combobox
'Custom' parameters in queries
How does the Excel application know the …
VSTO and VSTS integration
Work Items Areas and the WOrk Item OM
Deleted AD resource causes publishing er…
View history in MS Excel

Hot Articles

Customizing the trigger of the workitem …
Display fullpath with filename in the WI…
Walkthru question on "To save a doc…
Renaming column names in Query
File type missing when added file attach…
Remove Work Items from template
Team Projects sharing same Source Control
Readonly flag for System.ChangedBy field…
Work Item List Box Cotrols
Adding Areas and Iterations via the obje…
How to get the email body from an email …
Task numbering reset?
Searching work items
Difference between WorkItemLatest and Wo…
Contains operator for WorkItem HTML fiel…

Recommend Articles

Problem mapping OutlineNumber
Restricting who can add Workitems
System.ChangedBy populating with "c…
How to delete unwanted Work Items and se…
Importing existing tasks into the new Te…
Getting WorkItems by Project Name from T…
Connecting to work items with project
Adding a camera or screen shot utility t…
limit control type links control to spec…
Difference between WorkItemLatest and Wo…
missing Microsoft.TeamFoundation.WorkIte…
Prohibiting a user from reviewing their …
Can I Add a Customized Field Type for Wo…
Areas on Scenario
Can users add and view work items from t…