cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JManningJPS
New Member

Add row to Excel when a SharePoint item is restored?

Hi all,

I need help with creating a flow that adds a row to an Excel spreadsheet when deleted items in a SharePoint list are restored from the recycle bin. 

My organization uses Microsoft Forms for users to manually enter monthly scorecard data. I have created flows that move the form responses to a SharePoint list, but I also need to keep a record outside SharePoint of all changes made to the list. I created flows that add a row to an Excel Online spreadsheet when list items are created, modified, or deleted. However, there is currently no trigger available for "When a deleted item is restored". Restoring does not trigger the created/modified flow for some reason.

How can I solve this problem? I thought of two ways, but I can't figure out how to make them work.

  1. Export the version history to a file every hour/day/etc.
    • I have seen posts on how to do this with PowerShell scripts, but I don't have access to SharePoint cmdlets. Using an API call with the "Send an HTTP request" connector might work. However, it only takes a single item ID, and I need the history of all items.
    • Is it possible to get all of the list IDs and loop through them, adding a row for each one? If so, how would I do that?
  2. Periodically check the list to see if it contains any IDs that were previously deleted, then add a row for those items in the spreadsheet.
    • I have created a column in the spreadsheet named "IsDeleted". When an item is deleted, a flow inserts a new row with "IsDeleted" = 1.
    • Is it possible to get the unique item IDs from the spreadsheet where "IsDeleted" = 1 and check that against the current list of items? If so, how would I do that?

Can anyone suggest a solution to this problem? I would greatly appreciate it! Thank you very much!

1 ACCEPTED SOLUTION

Accepted Solutions
ScottShearer
Super User III
Super User III

@JManningJPS 

You may be able to get where you want to go, but it is likely to be a bit complicated.  I would like to suggest an alternate approach.  You might consider the following:

  1. Remove your users ability to delete items by using a custom permission level (break inheritance on the list.....)
  2. Add a yes/no column to the list and call the column "Delete"
  3. Exclude items where Delete is checked from all views available to users

Another avenue would be to have a Flow delete the items once Delete is checked.  Items could only be restored by you (since your connection is used to delete) or an SCA.

 

While this does not directly answer your question, it is a workable solution that can be implemented in just a few minutes.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

2 REPLIES 2
ScottShearer
Super User III
Super User III

@JManningJPS 

You may be able to get where you want to go, but it is likely to be a bit complicated.  I would like to suggest an alternate approach.  You might consider the following:

  1. Remove your users ability to delete items by using a custom permission level (break inheritance on the list.....)
  2. Add a yes/no column to the list and call the column "Delete"
  3. Exclude items where Delete is checked from all views available to users

Another avenue would be to have a Flow delete the items once Delete is checked.  Items could only be restored by you (since your connection is used to delete) or an SCA.

 

While this does not directly answer your question, it is a workable solution that can be implemented in just a few minutes.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

JManningJPS
New Member

@ScottShearer ,

 

Thank you very much for your suggestions. I think the first one might work for our purposes. I will take it to my team next week and see what they think. I greatly appreciate your help.

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,640)