I'm trying to set tfs new work item state value to "approved" and getting an error.
i'm validating before i actually save my work item, however the item is not getting because of the errors. The error is because i'm setting a new work item state directly to "Approved" where as it allows only one possible value "Draft". Unfortunately it's my requirement as i'm migrating my work items from a different source which is already in a "Approved" state.
(TF237124: Work Item is not ready to save). Fields: The 'State' field has the status InvalidListValue
tfsWorkItem.Fields["System.State"].Value = "Approved";
var invalidFields = tfsWorkItem.Validate();
if (null == invalidFields || 0 == invalidFields.Count)
{
tfsWorkItem.Save(); //Never comes here because of invalidFields
}
Thanks in advance, Jameel