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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors