0

I want to add a feedback mechanism in my software.

It's a good idea to get the required information for a TFS Feedback Response from the user and then create a TFS work item for it.

So my clear question would be:

Question: How can I add a 'Feedback Response' work item given its Title, Description, Team Project and Team Server using C#?

mehrandvd
  • 8,806
  • 12
  • 64
  • 111

1 Answers1

2

Quite straightforward:

var cred = new NetworkCredential("UserName", "Password", "Domain");
var tfs = 
    new TfsTeamProjectCollection(new Uri("YourServerUrl/Collection"), cred);
var workItemStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
var workItemTypes = workItemStore.Projects["ProjectName"].WorkItemTypes;
var workItemType = workItemTypes["Feedback Response"];
var workItem = new WorkItem(workItemType);

workItem.Title = "Feedback Response 1";
workItem.Description = "Totally awesome piece of software!";
workItem.Save();

Domain is either the actual domain, or in a Workgroup situation, it would be the name of the server that hosts the TFS Application Tier.Source

Answer is based on the article TFS 2010 API - Create WorkItems(Bugs) and tested on VS 2013 + TFS 2013.

Community
  • 1
  • 1
Yurii
  • 4,811
  • 7
  • 32
  • 41