I am writing a utility to read all defects from the old error tracking system and import them into TFS (2008/2010). I use the TFS API to create new WorkItems, set their fields, and then save them. However, I cannot change the "Created" and "Created date" fields because they are set by the system. (and there are other fields that I would like to use to force values, for example, to indicate that the submitter is someone who is not a valid TFS user)
// these fail with "The value for the field 'Created By' cannot be changed." defectWorkItem.Fields["Created By"].Value = defect.Submitter; defectWorkItem.Fields["Created Date"].Value = defect.SubmitDate;
Obviously, if I cannot set these fields, I get all outdated errors, similar to the fact that they were created on the same day by the same person.
Is there a way I can use the API, but make changes to the fields that are usually protected? I looked at direct access to the TFS database tables, but the schema looks complicated, and I think it would be rather risky to try to modify the data there.
source share