I want to create a new work item in TFS using the SDK, and I’d like to set the item’s effort estimates. My code at the moment looks like this
var coll = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://galaxy:8080/tfs/crisp"));
var workItemService = coll.GetService<WorkItemStore>();
var parent = workItemService.GetWorkItem(parentWorkItemId);
WorkItemType workItemType =parent.Project.WorkItemTypes
.Cast<WorkItemType>()
.First(candidateType => candidateType.Name.Equals("Task"));
WorkItem item = workItemType.NewWorkItem();
item.Title = work.Name;
//Set effort estimate here
workItemService.BatchSave(new WorkItem[]{ item });
But there doesn’t seem to be anything on the interface for WorkItem which allows me to set an effort estimate. Does anyone know how this is done?
Turns out it’s done by using the
[]operator on theWorkItemobject.