TFS Client object Model Question ->unable to create a task in TFS
-
2012年3月22日 21:08Hi All,
I am trying to automate the process of reading data from a REST WEb service and creating a TFS task. I am using the TFS client object Model. I am trying to create a work item of type "task" but unable to save it because it requires the"Code Reviewer" Field to be set.However, I have no way of accessing it.
Here is my code : I am using VS 2010
static void Main(string[] args)
{
Uri collectionUri = (args.Length < 1) ?
new Uri("http://server:8080/tfs/DefaultCollection") : new Uri(args[0]);
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(collectionUri);
WorkItemStore workItemStore = tpc.GetService<WorkItemStore>();
WorkItemTypeCollection workItemTypes = workItemStore.Projects["Servicing"].WorkItemTypes;
WorkItemType workItemType = workItemTypes["Task"];
WorkItem task = new WorkItem(workItemType );
task.Title = "Automated ";
task.Description = "Automated ";
task.Validate();
task.Save();
}
I am stuck here.Can somebody please help??
全部回复
-
2012年4月3日 3:50
Hi, can you please post your question on the TFS WIT forum here: http://social.msdn.microsoft.com/Forums/en-US/tfsworkitemtracking/threads? If you are trying to set non core fields in the work item you can get them and set them by doing task.Fields["Code Reviewer"]. You can read more about the WorkItem class here http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.workitemtracking.client.workitem.aspx.
Federico Kolliker Frers - MSFT
- 已建议为答案 Federico Kolliker Frers - MS 2012年4月3日 3:51
- 已标记为答案 Ewald Hofman - TFS Product TeamMicrosoft Employee 2012年8月14日 22:06

