The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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?
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