Work Item TFS
-
venerdì 2 marzo 2012 14:55Does anybody know how to create new Work Item in TFS using C#?
- Spostato Jack Zhai - MSFTMicrosoft Contingent Staff lunedì 5 marzo 2012 02:09 (From:Visual Studio UI Automation Testing (includes CodedUI))
Tutte le risposte
-
venerdì 2 marzo 2012 15:45
Answered here http://social.msdn.microsoft.com/Forums/en-US/tfsgeneral/thread/1ff5415e-0ef2-4c65-b0b7-a109187adf51 (Creating Work Items using TFS API (C#))Please remember to mark the replies as answers if they help.
Blog: http://geekswithblogs.net/TarunArora
Subscribe in a reader- Contrassegnato come risposta Vicky SongModerator martedì 13 marzo 2012 01:35
-
lunedì 5 marzo 2012 10:42
Thanks, but I don't understand why I need get existings WorkItems from TFS? I need only create new. But using this code from example, we also get workitems from TFS.
using (TfsTeamProjectCollection projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(value)))
{
WorkItemStore workItemStore = projectCollection.GetService<WorkItemStore>();WorkItem parent = workItemStore.GetWorkItem(11);
string parentTeamProject = parent.Fields[value].Value.ToString();
WorkItemType WorkItemType = workItemStore.Projects[parentTeamProject].WorkItemTypes[1];
WorkItem workItem = WorkItemType.NewWorkItem();
workItem.Fields["Title"].Value = "Random name";
workItem.Description = "Random Description";
workItem.Save();int newChildWorkItemID = workItem.Id;
} -
mercoledì 7 marzo 2012 06:17Moderatore
Hello Z.Zidane,
It is OK if you do not have the get work items lines in your sample code. So, you may have your code to be similar to the following:
using (TfsTeamProjectCollection projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(value))) { WorkItemStore workItemStore = projectCollection.GetService<WorkItemStore>(); WorkItemType WorkItemType = workItemStore.Projects["TeamProjectName"].WorkItemTypes["WorkItemTypeName"]; WorkItem workItem = WorkItemType.NewWorkItem(); workItem.Fields["Title"].Value = "Random name"; workItem.Description = "Random Description"; workItem.Save(); }Thanks.
Vicky Song [MSFT]
MSDN Community Support | Feedback to us
- Contrassegnato come risposta Vicky SongModerator martedì 13 marzo 2012 01:35
-
giovedì 8 marzo 2012 15:32
Thanks Vicky.
Z.Zidane - The sample showed how u can retrieve and create work item from the retrieved work items. More samples on the workItemStore available here http://blogs.microsoft.co.il/blogs/shair/archive/2011/05/18/tfs-api-index-parts-1-to-37.aspx
Please remember to mark the replies as answers if they help.
Blog: http://geekswithblogs.net/TarunArora
Subscribe in a reader- Contrassegnato come risposta Vicky SongModerator martedì 13 marzo 2012 01:35


