0
votes

I'm trying to sync VSTS with a system we currently use for work items. I'd like to create a work item with a certain id, so that it matches the other system.

Example, current system creates work item #471, I want to call the VSTS api to create a work item with that same 471 id.

Is this possible? It seems the id is only returned as part of the result and can't be set.

From the docs:

WorkItem result = workItemTrackingHttpClient.CreateWorkItemAsync(patchDocument, project, "Bug").Result;
Console.WriteLine("Bug Successfully Created: Bug #{0}", result.Id);

But I want to set that Id beforehand.

1

1 Answers

2
votes

No, you can not specify the work item ID when creating a work item.

Since work item ID is unique identifier which is assigned by system, if you specify the work item id when creating a work item via REST API, VSTS will detect the content in application/json-patch+json is invalid and return with 400 status (bad request).

If you want to match the work items between the "current system" and the VSTS account, you should create work item in VSTS without specifying work id. While after the work item is created, then read the work item id and add relations for the work item id between "current system" and the VSTS account.