how to copy work item from one project area to other programmatically using IWorkItemClient
2 answers
I don't know a good way to easily do this, but you can use the logic of:
1) connect to project area 1
2) read work item data
3) connect to project area 2
4) create new (empty) work item and then set the values of the attributes from the first work item to the new work item data
5) save new work item (in project area 2)
We do something similar in some "bridge" code that we have that takes a work item from one server and creates a new one on a different server (different team) and then sync'd comments and status back and forth.
Susan
1) connect to project area 1
2) read work item data
3) connect to project area 2
4) create new (empty) work item and then set the values of the attributes from the first work item to the new work item data
5) save new work item (in project area 2)
We do something similar in some "bridge" code that we have that takes a work item from one server and creates a new one on a different server (different team) and then sync'd comments and status back and forth.
Susan
Use the concrete class definition, WorkItem instead of IWorkItem (cast the IWorkItem to WorkItem)
WorkItem has a setProjectArea() method. you will need to have the working copy, and change the category, etc..
similar classes provide methods for comments, approvals, attachments.
they are usually internals however..
this only works on the same server of course..
WorkItem has a setProjectArea() method. you will need to have the working copy, and change the category, etc..
similar classes provide methods for comments, approvals, attachments.
they are usually internals however..
this only works on the same server of course..