How can I get the URL from a Changeset on a Participant?
![](http://jazz.net/_images/myphoto/5f7a6e4ca24939b3d00207c59f8cddb2.jpg)
When a change set is accesed via web browser you have an url address with this format:
https://<jts-server>:9443/ccm/web/projects/<Project_Area_Name>#action=com.ibm.team.scm.viewChangeSet&contextItemId=&contextItemType=null&changeSetItemId=<UUID>
List<IChangeSet> changeSets = auditableServer.resolveAuditables(changeSetHandles, ItemProfile.<IChangeSet>createFullProfile(IChangeSet.ITEM_TYPE, true), monitor);
Accepted answer
![](http://jazz.net/_images/myphoto/5f7a6e4ca24939b3d00207c59f8cddb2.jpg)
The data usually does not provide a URL, you have to compute that. For any element, you can use .origin() to get the team repository and from that you can get the public URI e.g.
((ITeamRepository) workItem.getOrigin()).publicUriRoot()
You can use com.ibm.team.repository.common.Location to create URI's
Location location = Location.namedLocation(workItem, ((ITeamRepository) workItem.getOrigin()).publicUriRoot());
You can use the Location to get the URI/URL.
Note there are different Location types namedLocation, itemLocation and you would have to look at the URL of an existing item to see the pattern and find out which location to use.
I usually use existing data and print that to understand what is supposed to be there.
See https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/
for some related code (you can get URI's from references and create them from URI's.
There is also code that creates URI's in the WCL: https://rsjazz.wordpress.com/2017/03/29/the-work-item-command-line-is-now-open-source/
Comments
![](http://jazz.net/_images/myphoto/5f7a6e4ca24939b3d00207c59f8cddb2.jpg)
Finally I did with:
URI uri = ChangeSetLocationFactory.createChangeSetWebURL(changeSetsHandle, targetWorkspace, getPublicRepositoryURL(), null);
As you noticed nameLocation and itemLocation are different. nameLocation works fine with WorkItems and itemLocation with Changesets and Workspaces (nameLocation on changeSets throws an IllegalStateException because referenced item has not defined a naming identifier). But when you use itemLocation on a Changeset the URI's result doesn't use the context (target workspace) hence with ChangeSetLocationFactory you get the complete URL with the worspace context too.