Defpotec2020
Defpotec2020

Reputation: 257

In Visual Studio Online, Pull Requests can be linked to Work Items. Is there a way to query based on that?

In Visual Studio Online, Pull Requests can be linked to Work Items. Is there a way to query based on that?

For example, can I create a query to find every Work Item associated with a particular Pull Request, and can I create a query to find the Pull Requests associated with a Work Item?

Thanks!

Upvotes: 2

Views: 1464

Answers (1)

Cece Dong - MSFT
Cece Dong - MSFT

Reputation: 31083

When a Pull Request links to a work item, this work item will create a history "Mentioned in Pull Request # ". You can list all work items that have Pull Request with the query below:

"Team Project = @Project" And "Work Item Type = [Any]" And "History Contains Words Pull Request".

Please notice the query above only can list all work items with Pull Request, no matter what number of the Pull Request. The query can't filter with a particular Pull Request. If the last change for a work item is to link to a Pull Request, you'll see the comment in the History column. Otherwise, you need to open the work item to check the history to see which Pull Request it links to. See the screenshot below: enter image description here

If you want to filter work items with a particular Pull Request, you may need to retrieve work item discussion history using VSO's REST api and filter from the history. Check blog on how to retrieve work item discussion history using VSO's REST api: http://blog.siliconvalve.com/2014/05/16/retrieve-work-item-discussion-history-using-visual-studio-onlines-rest-api/

Hop this can help somthing for you.

Upvotes: 1

Related Questions