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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
nic0dav
New Member

How to retrieve comments from a SharePoint list into Power BI ?

Hello,

 

I have linked y power BI report to a sharepoint list, I can see most information in the Power BI table but I cannot find the comments, is there a way to retrieve them?

 

Thank you

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

5 REPLIES 5
Thp889
Regular Visitor

Try This It should run through your list and give you all the comments, may be able to filter them out?

let
    siteUrl = "https://yoursiteurl",
    listName = "your list name",

    // Step 1: Get all item IDs
    listApiUrl = "_api/web/lists/getbytitle('" & listName & "')/items?$select=Id",
    itemResponse = Json.Document(Web.Contents(siteUrl, [
        RelativePath = listApiUrl,
        Headers=[Accept="application/json;odata=verbose"]
    ])),
    itemData = itemResponse[d][results],
    itemTable = Table.FromRecords(itemData),
    itemIds = Table.Column(itemTable, "Id"),

    // Step 2: Define comment fetcher with RelativePath
    GetComments = (itemId as number) as table =>
        let
            commentsPath = "_api/web/lists/getbytitle('" & listName & "')/items(" & Text.From(itemId) & ")/Comments()",
            response = Json.Document(Web.Contents(
                siteUrl,
                [
                    RelativePath = commentsPath,
                    Headers = [Accept="application/json;odata=verbose"]
                ]
            )),
            commentData = response[d][results],
            commentTable = Table.FromRecords(commentData),
            withItemId = Table.AddColumn(commentTable, "ItemId", each itemId)
        in
            withItemId,

    // Step 3: Loop through item IDs
    allComments = List.Transform(itemIds, each try GetComments(_) otherwise null),
    filteredComments = List.RemoveNulls(allComments),
    combinedComments = Table.Combine(filteredComments)
in
    combinedComments

 

Hi.

Thanks for sharing this query. It does work.  Do you have an updated query to keep Names/emails instead of "@1234" references? 
thanks. 

nic0dav
New Member

Thank you !

amitchandak
Super User
Super User

Has anyone figured out how to clean up mentions in the comments?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.