It's all about the answers!

Ask a question

how to copy work item from one project area to other programmatically using IWorkItemClient


suresh k (11169) | asked Mar 31 '14, 10:40 a.m.
how to copy work item from one project area to other programmatically using IWorkItemClient

2 answers



permanent link
Susan Hanson (1.6k2189193) | answered Mar 31 '14, 9:45 p.m.
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

permanent link
sam detweiler (12.5k6187201) | answered Mar 31 '14, 11:30 p.m.
edited Mar 31 '14, 11:32 p.m.
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..

Your answer


Register or to post your answer.