web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Exporting SharePoint L...
Power Automate
Answered

Exporting SharePoint List Comments - Beginner Friendly Advice Please

(0) ShareShare
ReportReport
Posted on by 26

Hello,

 

I've tried looking through the web and have found helpful links regarding exporting comments from List comments. Do I have to build a flow to use the REST API?  I have done a few flows, but don't know where to start with this one. Incredibly new to all this, so any instruction/tips are appreciated. Thanks in advance.

Categories:
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @jakefromstfarm ,

     

    Please try:

    vbofengmsft_0-1678160426156.png

     

    Best Regards,

    Bof

     

  • jakefromstfarm Profile Picture
    26 on at

    Thank you @v-bofeng-msft. This was super helpful.

  • mguzmanBSC_2023 Profile Picture
    27 on at

    This is very helpful.  Thank you!  How do I get the results in a friendly format that doesn't include the code and characters for a single item?  Currently I have the item results in HTML then convert to a PDF for record keeping. I'd like to include the comments that makes more sense to the user.  Example format below.

     

    Comments: Timestamp, username, @mention and comment.  Currently the comment is buried in a bunch of text. 

  • jakefromstfarm Profile Picture
    26 on at

    @mguzman Hello, I actually ended up doing something different for this reason. Here is my flow:

    jakefromstfarm_0-1678711471504.png

    jakefromstfarm_1-1678711547150.png

    jakefromstfarm_3-1678711613748.png

    To avoid all the stuff you don't want from the text in comments- you need to parse the JSON. You should be appending to string variables and update item should have the big string variable that we made earlier. If you have any questions, feel free to ask.

     

     

  • mguzmanBSC_2023 Profile Picture
    27 on at

    Thanks @jakefromstfarm ,

    I appreciate the screenshots as I'm very new to parsing JSON and a newbie and some of these steps.  I watched several tutorials and struggling to make your steps work with my flow.  Any detailed instructions or full screenshots of your steps and code would be helpful.....or any help out there 🙂  Attached are some of the steps in my flow.  As you can see in the comments section, I end up with a bunch of text where the comments are buried.  

    snapshot1.png
    snapshot2.png
    2023-03-13_14-01-45.png
  • mguzmanBSC_2023 Profile Picture
    27 on at

    I meant to embed my screenshots...snapshot1.pngsnapshot2.png2023-03-13_14-01-45.png

  • jakefromstfarm Profile Picture
    26 on at

    Hi @mguzmanBSC_2023 , sorry for the late reply.

     

    I'm going to try to attach an in-depth review of what I did. It looks like you might have a few unnecessary characters/words. Just for your situational awareness, this is going to auto-populate comments that are made on the list item itself and put them into another column called the Comments Log. I recommend doing this since it will export cleanly and nicely. The fields that are included in this column are: Name, Email, Date, and Text. Let's get started. 

    1) Instead of arrays, you will be working with strings. You can have these include whatever fields you want to keep from the comments. You are going to create another final string variable called whatever you want, but it's going to hold the entirety of your comment. Mine is called final comments stringed.

    jakefromstfarm_0-1678903624289.png

    jakefromstfarm_1-1678903655005.png

     

    2) You are going to input a Send HTTP Request connector. It should look like this.

    jakefromstfarm_2-1678903836313.png

    3) You are going to put in a conditional. Set it like this.

    jakefromstfarm_3-1678903916078.png

    4) Under no, put in the Parse JSON connector. Copy and paste this in.

    {
        "type": "object",
        "properties": {
            "d": {
                "type": "object",
                "properties": {
                    "results": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "__metadata": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "uri": {
                                            "type": "string"
                                        },
                                        "type": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "likedBy": {
                                    "type": "object",
                                    "properties": {
                                        "__deferred": {
                                            "type": "object",
                                            "properties": {
                                                "uri": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "replies": {
                                    "type": "object",
                                    "properties": {
                                        "__deferred": {
                                            "type": "object",
                                            "properties": {
                                                "uri": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "author": {
                                    "type": "object",
                                    "properties": {
                                        "__metadata": {
                                            "type": "object",
                                            "properties": {
                                                "type": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "directoryObjectId": {},
                                        "email": {
                                            "type": "string"
                                        },
                                        "expiration": {},
                                        "id": {
                                            "type": "integer"
                                        },
                                        "isActive": {
                                            "type": "boolean"
                                        },
                                        "isExternal": {
                                            "type": "boolean"
                                        },
                                        "jobTitle": {},
                                        "loginName": {
                                            "type": "string"
                                        },
                                        "name": {
                                            "type": "string"
                                        },
                                        "principalType": {
                                            "type": "integer"
                                        },
                                        "userId": {},
                                        "userPrincipalName": {}
                                    }
                                },
                                "createdDate": {
                                    "type": "string"
                                },
                                "id": {
                                    "type": "string"
                                },
                                "isLikedByUser": {
                                    "type": "boolean"
                                },
                                "isReply": {
                                    "type": "boolean"
                                },
                                "itemId": {
                                    "type": "integer"
                                },
                                "likeCount": {
                                    "type": "integer"
                                },
                                "listId": {
                                    "type": "string"
                                },
                                "mentions": {
                                    "type": "object",
                                    "properties": {
                                        "__metadata": {
                                            "type": "object",
                                            "properties": {
                                                "type": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "results": {
                                            "type": "array"
                                        }
                                    }
                                },
                                "parentId": {
                                    "type": "string"
                                },
                                "replyCount": {
                                    "type": "integer"
                                },
                                "text": {
                                    "type": "string"
                                }
                            },
                            "required": [
                                "__metadata",
                                "likedBy",
                                "replies",
                                "author",
                                "createdDate",
                                "id",
                                "isLikedByUser",
                                "isReply",
                                "itemId",
                                "likeCount",
                                "listId",
                                "mentions",
                                "parentId",
                                "replyCount",
                                "text"
                            ]
                        }
                    }
                }
            }
        }
    }
    5) Set your variables. Make sure you're picking the correct items from the Parse JSON connector from dynamic content. After setting the variables, you will use the compose function to meld them all together. And apply to each connector will attempt to nest it all for you. Input results in the value field from Compose. Make sure to put in line breaks as <br>. Append to string variable as the next connector like in the screenshot.
    jakefromstfarm_4-1678904144151.pngjakefromstfarm_5-1678904180220.png

    6) Lastly, select the Update Item connector. Input your final comments stringed variable in the Comments Log column. 

    jakefromstfarm_6-1678904364891.png

    You are done.

     

  • mguzmanBSC_2023 Profile Picture
    27 on at

    Hi @jakefromstfarm ,

     

    I appreciate your help.  The step-by-step details are extremely helpful.  I followed all your steps and getting this error.  What am I doing wrong or did I miss something?

     

    Error Details

    The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('Parse_JSON')?['properties']?['d']?['properties']?['results']' is of type 'Null'. The result must be a valid array.

     

    0_2023-03-16_8-37-04.png

    Here is my flow.

     

    1_2023-03-16_8-29-23.png2_2023-03-16_8-30-49.png3_2023-03-16_8-45-27.png4_2023-03-16_8-46-21.png5_2023-03-16_8-47-27.png

     

  • Carrida Profile Picture
    8 on at

    @mguzmanBSC_2023 - did you ever figure it out.  Currently running into the same issue with the same error message.

  • tristang5 Profile Picture
    2 on at

    Hi Bof,

     

    How would you recommend taking this forward to have the comments populate in an excel file based on a status in a column?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 302 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 130

Last 30 days Overall leaderboard