I've used this while writing the Cropper TFS Work Item plugin. I needed a way to edit or create a new work item. The WorkItemFormControl located under the Microsoft.TeamFoundation.WorkItemTracking.Controls namespace is the same control used by Visual Studio work item plugin and also by the process template editor (which was the way I found how to use it).
Here's an example for creating a new work item with the control.
First we need to connect to a Team Foundation Server and obtain the WorkItemStore service:
TeamFoundationServer tfs = new TeamFoundationServer(serverName);
tfs.EnsureAuthenticated();
WorkItemStore wis = tfs.GetService(typeof(WorkItemStore)) as WorkItemStore;
After doing so we can now create the WorkItemFormControl:
WorkItemFormControl wifc = new WorkItemFormControl();
The WorkItemFormControl has a string property named FormDefinition. We need to set this property with an XML defining the work item type that we want to use. To do so we use the WorkItemStore service:
WorkItemType wit = wis.Projects[teamProjectName].WorkItemTypes["Bug"];
This will return the the Bug work item type.
After doing so we can use the WorkItemType to set the FormDefinition property:
XmlDocument xmlDocument = wit.Export(false);
wifc.FormDefinition = xmlDocument.InnerXml;
Now we can use the WorkItemFormControl with a newly created work item or an existing one:
WorkItem wi = new WorkItem("Bug"); or WorkItem wi = wis.GetWorkItem(bugId);
wifc.Item = wi;
To show the control embed it to a form or a panel on a form.
Search This Blog
Showing posts with label cropper. Show all posts
Showing posts with label cropper. Show all posts
Tuesday, July 17, 2007
Wednesday, June 06, 2007
CropperTFSPlugin
I have uploaded the plugin to CodePlex. Here's the link to the project: http://www.codeplex.com/CropperTFSPlugin.
Labels:
attachment,
attachments,
Code Plex,
cropper,
plugin,
teamfoundationserver,
tfs,
WorkItem
Wednesday, May 30, 2007
Cropper TFS Work Item Plugin
It's been a while since I wrote here. Anyway, I hope this post will compensate for it. I read this week a post about SnagIt! integration with TFS. Since I use Cropper I've decided to write a plugin for TFS.
The plugin enables you to capture images directly to a new TFS work item attachments field. You can also add an attachment to an existing work item. You can download it from here. Read the read me file for installation guide and how to use it.
The plugin uses the WorkItemFormControl to edit the work item. I will explain in future posts on how to use it.
I'm planning to add the sources to Cropper Plugins project in CodePlex.
The plugin is in it's early stages. I would be happy to hear your comments.
The plugin enables you to capture images directly to a new TFS work item attachments field. You can also add an attachment to an existing work item. You can download it from here. Read the read me file for installation guide and how to use it.
The plugin uses the WorkItemFormControl to edit the work item. I will explain in future posts on how to use it.
I'm planning to add the sources to Cropper Plugins project in CodePlex.
The plugin is in it's early stages. I would be happy to hear your comments.
Labels:
attachment,
attachments,
c#,
Code Plex,
cropper,
Open Source,
plugin,
teamfoundationserver,
tfs,
WorkItem,
WorkItemStore
Subscribe to:
Posts (Atom)