It's all about the answers!

Ask a question

Programmatically resolving tracks/contributes links does not work

Marko Tomljenovic (3163789) | asked May 07 '15, 5:40 a.m.
I have problems getting linked work items (tracks/contributes) using the Java API. My code roughly looks like this:

// Resolve all work item references for the given item
IWorkItemReferences iWorkItemReferences = this.workItemClient.resolveWorkItemReferences(currentWorkItem, monitor);
// Find linked items of the given link type -> tracks/contributes
for (IEndPointDescriptor endPtDescriptor : this.linksToFollow) {
  List<IReference> wiReferencesTmp = iWorkItemReferences.getReferences(endPtDescriptor);
  if (wiReferencesTmp != null) {
for (IReference iReference : outgoingWIReferences) {
  IWorkItem nextWorkItem = null;
  try {
    IWorkItemHandle wiHandle = null;
    Object resolve = iReference.resolve();

I can get all the work item reference objects. But when calling the resolve() method it always returns null.
The reference objects are URI references with this URI  format:

What I found out is that Location.locationFromAbsUri(URI) is called where the ItemHandle in the Location instance is set to null.

        IItemHandle itemHandle = null;
        IType type = null;
        if (isOidUri(relativeUri)) {
            itemHandle = itemOidUriToHandle(relativeUri);
            type = itemHandle.getItemType();
        if (type == null) {
            type = relativeUriToType(relativeUri);
Any Idea why it does not work?

Marko Tomljenovic commented May 07 '15, 10:17 a.m.

Using your referenced code helps. It works now.

But shouldn't the resolve() method do the job properly?

Accepted answer

permanent link
Arne Bister (2.6k12732) | answered May 07 '15, 10:00 a.m.

will the code in this post to turn the URI into a WorkItem handle help?
If you can send me the code to business mail I can look over it, but not before next Monday.

Marko Tomljenovic selected this answer as the correct answer

Arne Bister commented May 12 '15, 3:53 p.m.


since you mentioned it works with the referenced code I converted my comment to answer. Could you please mark it as accepted?


Your answer

Register or to post your answer.