cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mag1c
Helper I
Helper I

Export Sharepoint list items with comments into CSV file

Hi everyone, I've followed this blogpost (https://divyeshkotadia.wordpress.com/2023/04/21/how-to-export-list-items-with-comments-into-excel-cs...) 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!

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Most Valuable Professional
Most Valuable Professional

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



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

18 REPLIES 18
Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @Mag1c,

 

Have a look at the Read ALL comments part of this blog from @DamoBird365https://www.damobird365.com/microsoft-list-add-comment/

 

That blog demonstrates how to replace those references with the actual names of the people mentioned by using a couple of Select actions and some expressions with split and replace functions.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


I appreciate your response. I tried following the blog but I get an error “the action join_objects is nested in a foreach scope of multiple levels. Referencing repetition actions from outside the scope is supported only when there are no multiple levels of nesting"

This is due to the REST API call to fetch all comments being a loop because I want to pull all of the records and its comments from a list, not just a single record and its comments. Any ideas on how to work around this?

Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @Mag1c,

 

It should also be possible to retrieve all comments from all items.

 

Because you already have a for each loop that one from the blog would be a nested one. That also means that you would have to update the expressions which are being used in the blog to point to the right for each loop action. Make sure that is is using the correct action name in the items function.

 

Can you share a screenshot of how you added the actions from the blog. This way I can easier point to what you need to change/update to make this work.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Sure, I've attached 3 screenshots of my flow. I changed the original quite a bit to add in the parts from the blog you mentioned and haven't cleaned it up yet as I'm testing so there are still some variables listed that won't be needed once it's working.

Hello @Expiscornovus @I provided 3 screenshots if you’re able to assist me with the error. Thanks!

Mag1c
Helper I
Helper I

Bumping this topic in case anyone can assist, thanks!

Expiscornovus
Most Valuable Professional
Most Valuable Professional

Hi @Mag1c,

 

Apologies for the delayed reply and thanks for sharing those screenshots. 

 

It looks like the issue might be in your Join Objects action. However, it the screenshot it is collapsed. I cannot see what your are using in that action. Can you share what you used in that action?



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


I've just copied/pasted the expression from the article you posted:

if(equals(length(item()?['mention']),0),items('Apply_to_each')?['text'],concat(join(body('Select_Text_and_Replace_Mention'),''),last(outputs('Split_on_Mention_Compose'))))
Mag1c
Helper I
Helper I

I think the issue is with my expression in the compose action. The article says this

Mag1c_0-1699367559728.png

but if I put exactly that code in as an expression it gives me an error saying it's invalid

 

@{outputs('join_objects')}

 

If I try it as the below code, it saves the expression but when I click save on the flow is when I get the error below.

 

outputs('join_objects')

 

 

 

 Flow save failed with the code 'invalidtemplate' and message 'the template validation failed: 'the inputs of the template action 'compose' at line '1 and column '5290' cannot reference action 'join_objects'. The action 'join_objects' is nested in a foreach scope of multiple levels. Referencing reptition actions from outside the scope is supported only when there are no multiple levels of nesting.

 

Mag1c
Helper I
Helper I

Bumping again to see if anyone is able to assist with this?

Expiscornovus
Most Valuable Professional
Most Valuable Professional

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



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


@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-cs... 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
Most Valuable Professional
Most Valuable Professional

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



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


@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
Most Valuable Professional
Most Valuable Professional

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



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #MicrosoftCopilotStudio content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


fireballs
Frequent Visitor

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

 

fireballs
Frequent Visitor

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
Frequent Visitor

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

Helpful resources

Announcements

Tuesday Tip | How to Get Community Support

It's time for another Tuesday Tip, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.       This Week: All About Community Support Whether you're a seasoned community veteran or just getting started, you may need a bit of help from time to time! If you need to share feedback with the Community Engagement team about the community or are looking for ways we can assist you with user groups, events, or something else, Community Support is the place to start.   Community Support is part of every one of our communities, accessible to all our community members.   Within each community's Community Support page, you'll find three distinct areas, each with a different focus to help you when you need support from us most. Power Apps: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pa_community_support Power Automate: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpa_community_support Power Pages: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpp_community_support Copilot Studio: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pva_community-support   Community Support Form If you need more assistance, you can reach out to the Community Team via the Community support form. Choose the type of support you require and fill in the form accordingly. We will respond to you promptly.    Thank you for being an active part of our community. Your contributions make a difference!   Best Regards, The Community Management Team

Community Roundup: A Look Back at Our Last 10 Tuesday Tips

As we continue to grow and learn together, it's important to reflect on the valuable insights we've shared. For today's #TuesdayTip, we're excited to take a moment to look back at the last 10 tips we've shared in case you missed any or want to revisit them. Thanks for your incredible support for this series--we're so glad it was able to help so many of you navigate your community experience!   Getting Started in the Community An overview of everything you need to know about navigating the community on one page!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Ranks and YOU Have you ever wondered how your fellow community members ascend the ranks within our community? We explain everything about ranks and how to achieve points so you can climb up in the rankings! Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Powering Up Your Community Profile Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile. Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Blogs--A Great Place to Start There's so much you'll discover in the Community Blogs, and we hope you'll check them out today!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Unlocking Community Achievements and Earning Badges Across the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. Check out some details on Community badges--and find out more in the detailed link at the end of the article! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Blogging in the Community Interested in blogging? Everything you need to know on writing blogs in our four communities! Get started blogging across the Power Platform communities today! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Subscriptions & Notifications We don't want you to miss a thing in the community! Read all about how to subscribe to sections of our forums and how to setup your notifications! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Getting Started with Private Messages & Macros Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Community User Groups Learn everything about being part of, starting, or leading a User Group in the Power Platform Community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Update Your Community Profile Today! Keep your community profile up to date which is essential for staying connected and engaged with the community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Thank you for being an integral part of our journey.   Here's to many more Tuesday Tips as we pave the way for a brighter, more connected future! As always, watch the News & Announcements for the next set of tips, coming soon!    

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip: Getting Started with Private Messages & Macros

Welcome to TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   This Week's Tip: Private Messaging & Macros in Power Apps Community   Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member!   Our Knowledge Base article about private messaging and macros is the best place to find out more. Check it out today and discover some key tips and tricks when it comes to messages and macros:   Private Messaging: Learn how to enable private messages in your community profile and ensure you’re connected with other community membersMacros Explained: Discover the convenience of macros—prewritten text snippets that save time when posting in forums or sending private messagesCreating Macros: Follow simple steps to create your own macros for efficient communication within the Power Apps CommunityUsage Guide: Understand how to apply macros in posts and private messages, enhancing your interaction with the Community For detailed instructions and more information, visit the full page in your community today:Power Apps: Enabling Private Messaging & How to Use Macros (Power Apps)Power Automate: Enabling Private Messaging & How to Use Macros (Power Automate)  Copilot Studio: Enabling Private Messaging &How to Use Macros (Copilot Studio) Power Pages: Enabling Private Messaging & How to Use Macros (Power Pages)

Tuesday Tip: Subscriptions & Notifications

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!   This Week: All About Subscriptions & Notifications We don't want you to a miss a thing in the Community! The best way to make sure you know what's going on in the News & Announcements, to blogs you follow, or forums and galleries you're interested in is to subscribe! These subscriptions ensure you receive automated messages about the most recent posts and replies. Even better, there are multiple ways you can subscribe to content and boards in the community! (Please note: if you have created an AAD (Azure Active Directory) account you won't be able to receive e-mail notifications.)   Subscribing to a Category  When you're looking at the entire category, select from the Options drop down and choose Subscribe.     You can then choose to Subscribe to all of the boards or select only the boards you want to receive notifications. When you're satisfied with your choices, click Save.     Subscribing to a Topic You can also subscribe to a single topic by clicking Subscribe from the Options drop down menu, while you are viewing the topic or in the General board overview, respectively.     Subscribing to a Label Find the labels at the bottom left of a post.From a particular post with a label, click on the label to filter by that label. This opens a window containing a list of posts with the label you have selected. Click Subscribe.     Note: You can only subscribe to a label at the board level. If you subscribe to a label named 'Copilot' at board #1, it will not automatically subscribe you to an identically named label at board #2. You will have to subscribe twice, once at each board.   Bookmarks Just like you can subscribe to topics and categories, you can also bookmark topics and boards from the same menus! Simply go to the Topic Options drop down menu to bookmark a topic or the Options drop down to bookmark a board. The difference between subscribing and bookmarking is that subscriptions provide you with notifications, whereas bookmarks provide you a static way of easily accessing your favorite boards from the My subscriptions area.   Managing & Viewing Your Subscriptions & Bookmarks To manage your subscriptions, click on your avatar and select My subscriptions from the drop-down menu.     From the Subscriptions & Notifications tab, you can manage your subscriptions, including your e-mail subscription options, your bookmarks, your notification settings, and your email notification format.     You can see a list of all your subscriptions and bookmarks and choose which ones to delete, either individually or in bulk, by checking multiple boxes.     A Note on Following Friends on Mobile Adding someone as a friend or selecting Follow in the mobile view does not allow you to subscribe to their activity feed. You will merely be able to see your friends’ biography, other personal information, or online status, and send messages more quickly by choosing who to send the message to from a list, as opposed to having to search by username.

Users online (3,579)