I was sitting in Richard’s Scrum course last week when he mentioned “I wish we had notepad for creating work items”. Since I had that hour kind of free I decided to write it for him.
While I wanted the finished product to be a Windows gadget I decided to initially shim the UI in WPF…See Below.
The next step was to implement the the “Save” Button.
Public Class TFSnotePad
Public Function addWI(ByVal title As String, ByVal desc As String) As String
Dim tfsServer As String = "http://localhost:8080/tfs"
Dim teamFoundationServer1 As Microsoft.TeamFoundation.Client.TfsTeamProjectCollection = Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory.GetTeamProjectCollection(New Uri(tfsServer))
Dim workItemStore1 As New WorkItemStore(teamFoundationServer1)
Dim WorkItemStore As WorkItemStore = New WorkItemStore(tfsServer)
Dim tfsProject As Project = WorkItemStore.Projects(0)
Dim wIType As WorkItemType = tfsProject.WorkItemTypes("Bug")
Dim workItem As WorkItem = New WorkItem(wIType)
workItem.Title = Now.ToLongTimeString + title
workItem.Description = desc
Dim result As ArrayList = workItem.Validate()
If result.Count > 0 Then
Return (result(0).ToString + "There was an error adding this work item to the work item repository")
For Each pr In WorkItemStore.Projects
Return ("Added work items to: " + pr.Name.ToString)
…I only needed to add references to the following three assemblies
And presto I was done!
Thanks for the great class Richard!