Fetching snapshot from BuildResult
In RTC client someone could download the snapshot generated by the Build in the BuildResult page (there is a link to lead you to the snapshot).
Accepted answer
Here is how you retrieve the snapshot (IBaselineSetHandle) associated with a build result using the client-side Java API. (Note: I am assuming you already know the code used to fetch the full IBaselineSet from the IBaselineSetHandle):
...
IBuildResultHandle buildResultHandle = getBuildResultHandle(); // This can be 'any' build result or 'release'
IBaselineSetHandle snapshotHandle = null;
ITeamBuildClient client = (ITeamBuildClient) getRepository().getClientLibrary(ITeamBuildClient.class);
IBuildResultContribution[] contribution = client.getBuildResultContributions(buildResultHandle ,
new String[] { ScmConstants.EXTENDED_DATA_TYPE_ID_BUILD_SNAPSHOT }, monitor);
if (contribution.length > 0) { // It's possible for a build to NOT have a snapshot contribution
snapshotHandle = (IBaselineSetHandle) contribution[0].getExtendedContribution();
}
...
2 other answers
Comments
Thanks Ralph, I have reviewed https://jazz.net/library/article/807 but couldn't find any luck.
Is there any opportunity to fetch a snapshot from a release via java plain api?
Comments
It does not make sense to "reactivate" a 6 years old question. Anyway, if the release was created from a build you can open the build result from the release in the Eclipse client and from the build result you can get at the snapshot, It is available in the Eclipse client, so the likelihood to be able to do this using the plain java API is pretty high. It might use internal API. I have no example code.