Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
noneother
Frequent Visitor

How to retrieve the latest comment from every user story in Azure DevOps?

Hi

Does anyone know how to retrieve the latest comment from every workitem in Azure DevOps? There is one organisation and one project only, no need to retrieve from multiple projects.

 

I tried following this: https://community.fabric.microsoft.com/t5/Power-Query/Accessing-Description-in-AzureDevops-from-Powe...

but this is only for a single workitem.

 

Also, how to remove the HTML tags?

1 REPLY 1
ferryv
Resolver II
Resolver II

Hi.

 

You can retrieve comments via the following API: https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/comments/get-comments?view=azure-devops-... 

 

You can use the CommentSortOrder to order the comments retrieved in asc or desc order (latest first is desc order) and you can set the top to 1 to only return the latest.

 

The article in the thread you mentioned (https://www.linkedin.com/pulse/retrieve-long-text-fields-from-azure-devops-powerbi-van-der-vorst/) also explains how to strip the html from the comment (it is similar to how the HTML is removed form the Description, etc). 

 

//Tidy up code from here 

#"Add bullets for bulletlist (AC)" = Table.ReplaceValue(#"Expanded VSTS.fields","<li>", "<li>- ",Replacer.ReplaceText,{"VSTS.fields.Microsoft.VSTS.Common.AcceptanceCriteria"} ),

#"Add lf for divs (AC)" = Table.ReplaceValue(#"Add bullets for bulletlist (AC)","<div>", "#(lf)<div>",Replacer.ReplaceText,{"VSTS.fields.Microsoft.VSTS.Common.AcceptanceCriteria"} ),

#"Add lf for li (AC)" = Table.ReplaceValue(#"Add lf for divs (AC)","</li>", "</li>#(lf)",Replacer.ReplaceText,{"VSTS.fields.Microsoft.VSTS.Common.AcceptanceCriteria"} ),

#"Remove HTML from Acceptance Criteria" = Table.AddColumn( #"Add lf for li (AC)","Acceptance Criteria", each if [VSTS.fields.Microsoft.VSTS.Common.AcceptanceCriteria] = null then null else Text.Combine(Html.Table([VSTS.fields.Microsoft.VSTS.Common.AcceptanceCriteria],{{"AC",":root"}})[AC],"#(lf)"))

in 
#"Remove HTML from Acceptance Criteria" 

  Hope this helps

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Kudoed Authors