You can access the list of fields from the WorkItemType using the FieldDefinitions properties, which is a collection of FieldDefinition.
The FieldDefinition define some properties like the Name, FieldType and other properties that define the behaviour of the field (CanSortBy, IsComputed, IsEditable, Isqueryable, etc).
WorkItemType wit = ...; foreach (FieldDefinition fd in wit.FieldDefinitions) Debug.WriteLine(fd.Name + "\t" + fd.FieldType);
You access the WorkItemType available by using the WorkItemTypes property in the Project class.
Project project = ...; WorkItemTypeCollection types = project.WorkItemTypes;
To create WorkItem, you need to specify the type that you want to create. The post Retreive the list of WorkItemTypes describe how to obtain the available types.
WorkItemType wit; WorkItem workItem = new WorkItem(wit); workitem["Title"] "My title"; workitem.Save();
The WorkItemStore has a method BatchSave that take a array of WorkItem to save in the same batch. This reduce the network overhead.
List workItemToSave = new List();
As getting a field value, changing it is also simple. You use the bracket and pass the field name as follow:
workitem["Title"] = "My title";
The WorkItem class also have a few properties with set accessor that are easier to use. But not all fields are available, just the basics one.
r.IterationPath = "Project/Iteration1"; r.AreaPath = "Project/Area1";
As you can see in the previous example, you don’t need to worry about the ids. Just set the value.
You can optimize the save when you do multiple WorkItem modifications. Click here to see the post
TfsBuddy is a Desktop application, that connect to the TfsServer and add missing WorkItem management and planning fucntionnalities.
- Create a work item (Show the list of work item types) (Ctrl-N)
- Find a Work item from it’s ID (F3)
- Print a summary or detailled list
- Export the list to Excel or the Clipboard
- Search for items that have the match the text
- Double-click or press F2 on a item to edit the WorkItem
Item detail pane
The Item detail pane display the important information regarding the selected item:
The progression indicator show the pourcentage of completion. When the original time is less than the completed+remaining time, a black line is showed on top of the indicator to show what was suppose to be the original development.
The summary pane display summary informations about the items displayed in the list. The Different statistics are shown: Total, Iteration, Assigned to, Type, State and priority. For each statistic, the total hours and count are displayed.
You can create different views to speed up your work. For example, if you work on different iterations or differents produts, you can define a view per product per iteration. You can filter the work items displayed by any fields.
To filter the values displayed, click on the (All) button and select values that you want to keep.
- Rename the view name
- Create a copy of the view
- Delete the current view
- Choose the columns to display
- Change the group
- Change the sort order
- Bold the item that are assigned to me
- Colorize the item based on the item priority
When you select work items, you can right-click to display the quick actions contextual menu.
Via the quick action menu, you can change the priority, the assignee, the iteration, the area and the state of a batch of items.
When you choose multiple items and select Priority, only the prioities available for all the selected items are displayed.
You can change the completed time via the Add completed time and change the remaining time of a item via the Set remaining time (F9).
A other usefull functionality is the Export selection to Clipboard and to Excel.
The Kanban board display the workitem card in columns where each column is a state.
You can drag’n drop item from ont state to a other, changing the state of the item.
Summarize item informations are displayed in every card like the type via it’s icon, the id, the priority, the title, the assignee and the remaining hours. You can click on the priority, assignee and remaining hours to change the value.
You can also double-click on the card to edit the item.
1.5 – Dashboard
1.6 – Burndown chrt
2.0 – Iteration timeline
Tested with the MSF for Agile Software Development v5.0 template. It should work with customized template as well. Let me know if it doesnt’ work
1.4 – October 14th 2012
- Kanban board
- Summary and detailled print
- Added Priority group in the Summary pane
- The list for the filter Assigned To was not sorted and had a empty line
1.3.1 – October 2th 2012
- Added a rename view button
- Added a copy view button
- Display <None> for the group label when it’s empty
- Added a attachment viewer for images. When double-clicking on a attachment that’s a image, TFSBuddy use it’s own window to display the image.
- Added a count column in the Summary pane
- Added the total statitstic in the Summary pane
- Added the type and state group in the Summary pane
- System.Bitmap was displayed when exporting to Excel
- Export selection to Excel was exporting all items
- The X button for the search now do not hide when a filter is applied
1.3 – September 18th 2012
- Added the view management which allow the definition of multiple views which define columns, sort, group and filters
- Added Bold my items
- Added Coloriz items by priority
- Added GroupBy, which allow the user to specify which field is used as grouping key
- Added the attachment icon field that display a atcchment icon when the item has at least one attachment
- Added the SummaryPane
- Display <empty> in the filter choices
- Added the CreatedBy field in the Item detail pane
- When selecting a intermediate iteration (B in A/B/C), only the B items are displayed
- The TfsServer uri is specified in the App.config which is now global to the application. Each user doesn’t need to specify the uri on the first execution
- Esecute the Search only when the search button is clicked. It was executed every 200ms, but it was slow on some computer when the user doesn’t type quickly
- The group order wasn’t correct
1.2 – June 10th 2012
- Added a ‘Save and Close’ button on the Work Item Form.
- Added a ‘Paste Image’ button on the Work Item Form that add the image to the WorkItem from the clipboard (Ctrl-V)
- Added the Attachments list on the Item detail
- Allow the edition of multiples concurrent items
- Added a Search Work Item from it’s ID
- Added a Clear button that clear the Search box
- Do a reload of the item before launching the item edit, so if the item was modified by a other user, the new information is loaded
- Do a refresh after the item creation and edition
1.1 – May 10th 2012
- Added Create Work Items
- Added ‘Add Complete Time’ feature. Increase the completed time while reducing the remaining
- Added ‘Clear Remaining Time’ feature
- You can choose the columns that you want to display
- You can choose the columns on which you want to sort
- Added multi-select on the filters
- Initial release
Getting the value of a field from a WorkItem is really simple. You use the bracket and pass the field name as follow:
int id = (int)r["ID"]; string title = workitem["Title"];
The WorkItem class also have a few properties with get accessor that are easier to use. But not all fields are available, just the basics one.
string iteration = r.IterationPath; string area = r.AreaPath;