locked
TFS Client object Model Question ->unable to create a task in TFS

    问题

  • Hi 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年3月22日 21:08

答案