'VSTS: How to get all linked work items since last successful release to production?

We are using Visual Studio Team Services w/ Git and VSTS Release Management. We are running a continuous delivery model using pull requests. So each merged pull request triggers a potential release from an according build that ultimately would end up in production.

Each release lists the linked work items associated to the according direct pull request. VSTS states:

All work items that were included in commits will be displayed in the below list. Comparing current release with %previous release%.

However, not all pull requests make it to production, although they have been merged into the codebase already. That means, subsequent builds are actually based on such (not released) pull requests referring not only to the directly linked work items (from the pull request) but also to the work items of all the (not yet released) pull requests. These work items however, are currently not visible in the "Work Items" overview, which is an issue for our QAs.

Is there an official way to get a list of all previously linked work items associated to that (current) release compared to the last successful release on production? In other words: I am looking for a way to get the change log of the release that is going to go live (relative to the last complete release).

I've already tried to use the VSTS REST API https://www.visualstudio.com/en-us/integrate/api/overview but couldn't find suitable functions there.



Solution 1:[1]

Meanwhile I've found a workaround for my problem. As of now the VSTS REST Api (version 1.0) does not support querying release or build information. However, it knows pull requests: https://www.visualstudio.com/integrate/api/git/pull-requests and work items: https://www.visualstudio.com/integrate/api/wit/work-items

A pre-condition for this to work is that you link your pull requests with your work items. The moment a pull request gets merged into master, it usually mentions linked work items in the commit message. This is, how I currently can resolve all work items linked to these (completed) pull requests that have been merged between two dates (e.g. last release and now).

It's not the best solution but it works.

Solution 2:[2]

In version 5.0 preview of the API it seems to now support "Get Work Items Between Builds". Note that the fromBuildId and toBuildId parameters should be populated with the buildId, not the build number displayed on the UI. You can get the buildId by navigating to a specific build, and copying the buildId out of the URL.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Robert
Solution 2