- The user in one of the fields (which is implementing the valid user value list as the allowed values for the field) was renamed or deleted.
- The work item schema was changed in a way that made some of the existing work items have illegal values. For example, if you made one of the fields mandatory trough all of the work flow and you have some work items with a null value in the field.
So, how can you fix it?
There are 2 ways to do it:
- Changing the work item schema temporarily so the field won't be disabled and then you can change the value.
- Write some code the change the field value:
Here's a code sample on how to update work item field values:
public void UpdateWorkItem(string serverUri, int id, string fieldName, string fieldValue)
{
TeamFoundationServer tfs = new TeamFoundationServer(serverUri);
tfs.EnsureAuthenticated();
WorkItemStore wis = tfs.GetService(typeof(WorkItemStore)) as WorkItemStore;
WorkItem workItem = wis.GetWorkItem(id);
workItem.Open();
workItem.Fields[fieldName].Value = fieldValue;
workItem.Save();
}
2 comments:
So how do we change the work item schema??
You can use the ALLOWEXISTINGVALUE (http://msdn.microsoft.com/en-us/library/aa337642(VS.80).aspx) element.
Post a Comment