Skip to main content

Notifications

Community site session details

Community site session details

Session Id : GyopzHH+tDlAXTBEnDQM24
Power Automate - Building Flows
Answered

Export Sharepoint list items with comments into CSV file

Like (2) ShareShare
ReportReport
Posted on 24 Oct 2023 19:07:38 by 43

Hi everyone, I've followed this blogpost (https://divyeshkotadia.wordpress.com/2023/04/21/how-to-export-list-items-with-comments-into-excel-csv-file-using-power-automate/) and it has me 95% of the way there but there are two issues.

 

1. The @mentions in comments when they are linked in o365 do not show the username/email of the individual but the replace function the creator used. (if you are viewing the blogpost this is the step I'm referring to Replace mentions in comment)

Mag1c_0-1698174553761.png

 

 

For instance it should be @John Smith but it says @mention{0} instead. I'm not quite sure why this is and how to resolve it. We have sometimes 10+ comments on a single Sharepoint list item with multiple people mentioned in the comment so I would love to get this resolved.

 

2. This issue is less important but the comments are listed newest to oldest, how can I get them to list oldest to newest (first comment to latest comment).

 

Thank you in advance!

  • CU07080038-0 Profile Picture
    4 on 09 Aug 2024 at 02:49:59
    Export Sharepoint list items with comments into CSV file
    Hi @mag1c,
     
    I looked back at the original blog post (https://divyeshkotadia.wordpress.com/2023/04/21/how-to-export-list-items-with-comments-into-excel-csv-file-using-power-automate/).  If you are still having issues with not all comments being displayed in excel and display name not showing the following actions fixed it for me.  I am not sure if it will do the same for you. 
     
    In "Loop through comments to build comment string", switch the actions under Yes and No.  
     
    Under "No" > "Append new comment to Itemcomments (with comments)" I added a return after "createdDate" which made the next comment go under the newer comment vs a long string of comments.  
     
     
    I hope this fixes your issues like it fixed mine.
  • CU07080038-0 Profile Picture
    4 on 07 Aug 2024 at 01:45:07
    Export Sharepoint list items with comments into CSV file
    I did my best to follow along, but I am so confused. I too started to follow the same blogpost (https://divyeshkotadia.wordpress.com/2023/04/21/how-to-export-list-items-with-comments-into-excel-csv-file-using-power-automate/) 
     
    Then altered the above steps with the instructions from Microsoft List – Add Comment - DamoBird365 but I would receive an error for each action after GET action in the Loop through items for comments.
     
    Any help will be greatly appreciated.
     
    Thank you
  • fireballs Profile Picture
    13 on 14 Mar 2024 at 13:16:29
    Re: Export Sharepoint list items with comments into CSV file

    Solved - moved the MentionID integer reset to AFTER the loop.

  • fireballs Profile Picture
    13 on 12 Mar 2024 at 20:24:24
    Re: Export Sharepoint list items with comments into CSV file

    Figured this out by reseting the mentionID integer to -1 within the loop

     

    New problem: multiple @ mention IDs do not get updated within the one comment, only the first one!

  • fireballs Profile Picture
    13 on 12 Mar 2024 at 19:00:33
    Re: Export Sharepoint list items with comments into CSV file

    I have a similar issue- I can generate a correct replacement for the first @mention ID - but each @ mention after the first one returns the @mention{0} instead in the CSV 

     

    fireballs_0-1710269856325.png

    fireballs_1-1710269878785.png

    fireballs_2-1710269894903.png

    fireballs_3-1710270024450.png

     

  • Verified answer
    Expiscornovus Profile Picture
    31,671 Most Valuable Professional on 15 Nov 2023 at 08:53:53
    Re: Export Sharepoint list items with comments into CSV file

    Hi @Mag1c,

     

    To add those fields you can include them in the first Select, directly after the Send an HTTP request to SharePoint action. You also need to change the expression for the Text field as well, that it does not include the date time anymore.

     

    Below is an example

     

    1. Changed the Select to use the below

    {
     "Created": @{formatdatetime(item()?['createdDate'],'dd-MM-yy HH:mm')},
     "CreatedBy": @{item()?['author/Name']},
     "Text": @{item()?['text']},
     "Mention": @{item()?['mentions']?['results']}
    }

     

    select_author.png 

    2. Change the Add a row action to use the below of the two new fields

     

    item()['CreatedBy']

     

    item()['Created']

     

    addarowintoatable.png

     

     

    3. The export should now look like the below

     

    comments_export.png

  • Mag1c Profile Picture
    43 on 14 Nov 2023 at 18:40:04
    Re: Export Sharepoint list items with comments into CSV file

    @Expiscornovus THANK YOU SO MUCH! I just have a couple of follow up questions, how can I add a column with the creator/user who submitted the comment (submitted by) and the date/time stamp of when they added it? I've tried a few things but I'm missing something.

    Mag1c_0-1699986838592.png

     

    Lastly, it looks like it's not handling special characters well, specifically the "&" and ":". For the "&" it says "&" and the ":" it says ":". Not really huge issues as I can resolve them with power BI, as that's how I plan to merge the comments to a single row anyways.

     

    THANKS AGAIN SO MUCH, nearly there!

  • Expiscornovus Profile Picture
    31,671 Most Valuable Professional on 14 Nov 2023 at 15:16:44
    Re: Export Sharepoint list items with comments into CSV file

    Hi @Mag1c,

     

    I think you are pretty close. In that case I would suggest to add a Add a new row in table action directly after the Join Objects action (still within the Apply to each loop).

     

    Below is an example

     

    ID field of my table uses

    items('Loop_through_items_for_comments')['id']

     

    Comment Text field of my table uses the Outputs of the Join Objects action

    outputs('Join_Objects')

     

    addarowintotable.png

     

    Test result is the below

     

    exporttofile.png

  • Mag1c Profile Picture
    43 on 14 Nov 2023 at 13:46:07
    Re: Export Sharepoint list items with comments into CSV file

    @Expiscornovus  My compose action was outside of the apply to each loop but even when I add it inside I still get an error:

     

    Mag1c_0-1699969363391.png

     

    Just to refresh as this has been an issue going on a couple of weeks... the initial flow I was using works but has the issue with the @mention in comments showing the code instead of the user's name. - https://divyeshkotadia.wordpress.com/2023/04/21/how-to-export-list-items-with-comments-into-excel-csv-file-using-power-automate/ this is the flow I'm referencing. 

     

    You suggested this flow - https://www.damobird365.com/microsoft-list-add-comment/ , to resolve the issue, which it does but only for a single ID in a sharepoint list, not all the of rows/IDs in a sharepoint list which is what I need. I am attemping to export all of the comments out of the list one time.

     

    Essentially, I just need help converting https://www.damobird365.com/microsoft-list-add-comment/ from one single ID to exporting all of the comments in a SP list to a spreadsheet. I tried combining the two referenced flows but am clearly having some issues. 

     

    I hope that helps provide some clarity on this and you can help me resolve, I really appreciate it!

     

  • Expiscornovus Profile Picture
    31,671 Most Valuable Professional on 14 Nov 2023 at 09:16:24
    Re: Export Sharepoint list items with comments into CSV file

    Hi @Mag1c,

     

    Sorry, I get a lot of notifications so I missed this one again, my bad 😅

     

    My guess is that the compose is in the wrong location. Is that compose action outside the apply to each loop? If that is the case you will get this error message. Place the compose within the loop.

     

    Btw, if you want to store all text you probably want to use a string variable (initialize variable action at the beginning of your flow) and use an append to string variable action at the end of each loop.

     

    compose_withinapplytoeach.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 87

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 70 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 48 Super User 2025 Season 1

Overall leaderboard