It's all about the answers!

Ask a question

Work item URL


Kinny Kun (5183) | asked Feb 23 '09, 5:23 p.m.
Hi,

Is there a way to get the URL of an IWorkItem object? The URL that takes user directly to the details of the work item.

Many thanks.

Comments
Nicolas Bros commented Mar 20 '14, 9:32 a.m. | edited Mar 20 '14, 9:46 a.m.

I'm looking for an answer to this as well.


sam detweiler commented Mar 20 '14, 9:42 a.m. | edited Mar 20 '14, 9:43 a.m.

don't understand.. the URL of the workitem would open the UI if used in a browser.

and the UI lands on the overview page 

what are u looking to do? 

sorry, maybe misunderstood the words..

in Eclipse, click the dropdown next to the workitem number and select copy URL
in the web, just copy the URL in the browser window

Accepted answer


permanent link
Nicolas Bros (295) | answered Mar 31 '14, 10:26 a.m.
I found the class com.ibm.team.repository.common.Location in the RTC API, which avoids hard-coding URI fragments. For example:
String workitemURL = Location.namedLocation(workitem, getPublicRepositoryURL()).toAbsoluteUri().toString();
Ralph Schoon selected this answer as the correct answer

Comments
sam detweiler commented Mar 31 '14, 10:32 a.m.

Nice!.. thanks 

One other answer



permanent link
Nicolas Bros (295) | answered Mar 31 '14, 7:40 a.m.
I'm looking for a way to get the URI programmatically for any IWorkItem instance, not through the UI for a specific workitem.

Comments
sam detweiler commented Mar 31 '14, 8:49 a.m.

ok, well, the model is


server + "/resource/itemName/com.ibm.team.workitem.WorkItem/" + number

you can get server from the repository object.

repository.getRepositoryURI();

most objects have a getOrigin() method that returns the repository object

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.