It's all about the answers!

Ask a question

How we can fetch work item change sets using client API?

Rinkal Garg (1716) | asked Mar 21 '18, 5:49 a.m.
edited Mar 21 '18, 8:50 a.m.

 If there is any other way to find out change sets using work item Id. Please help

Accepted answer

permanent link
Ralph Schoon (58.7k23642) | answered Mar 21 '18, 9:04 a.m.

Yes, you can find the work item using its ID. Then you iterate the links of that work item and finds the ones that are to a change set. Then you can identify the change set and do whatever needed with it.

How to use IWorkItemCommon.findWorkItemById() to find a work item by ID is explained in explains how to follow links. This is example code to find the handles

for (IReference reference : references) {
    if (reference.isItemReference()) {
        IItemHandle refItem = (IItemHandle) reference.resolve();
        if (refItem instanceof IChangeSetHandle) {
            ....(IChangeSetHandle) refItem;
Rinkal Garg selected this answer as the correct answer

Rinkal Garg commented Mar 22 '18, 2:36 a.m. | edited Mar 22 '18, 3:34 a.m.

Now I have links collection with me, and I am using the below code to find change set :
Collection<ILink> links = linkCollection.getLinksById("");
 But every time it returns blank list. Please help. 

Rinkal Garg commented Mar 26 '18, 3:03 a.m.

@Ralph any suggestion?

Ralph Schoon commented Mar 26 '18, 4:32 a.m.

I have provided you with several links to blog posts. One of them was around the link API. As far as I remember the code there iterates over all link types and can print information. I created the code because I was not sure what to expect. Maybe you want to follow that example.

One other answer

permanent link
arif ahnan (11) | answered Mar 26 '18, 5:47 a.m.
edited Mar 26 '18, 5:53 a.m. by Ralph Schoon (58.7k23642)

 this is very helpful once thanks sir Ralph Schon

Your answer

Register or to post your answer.