TFS Api - Assign new work item to a parent

Asked

Viewed 42 times

0

I am creating a new Workitem and need to change the responsible person(Field: Assigne To) for it. To create the Workitem I do as follows:

WorkItem workItem = new WorkItem(workItemType)
{    
    State = "A RESOLVER",
    Title = "[TESTE INTEGRAÇÃO] " + solicitacao.numero + " - " + solicitacao.descricao,
    AreaPath = ITERATION_PATH + "\\" + solicitacao.tipo,
    Description = GetDescriptionMessage(solicitacao),
    IterationPath = GetCurrentIterationPath(ITERATION_PATH),
};
workItem.Save();

How do I gain access to the field Assignedto?

1 answer

0


I have found a solution, but I believe there must be other ways. The Assignedto field is inside the Fields property, so to access it is very simple:

workItem.Fields[CoreField.AssignedTo].Value = value;

However I could not assign the value inside the constructor

//WorkItem workItem = new WorkItem(workItemType)
//{
//    Fields[CoreField.AssignedTo].Value = value
//}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.