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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Recreate deleted items
Power Automate
Answered

Recreate deleted items

(0) ShareShare
ReportReport
Posted on by 30

Hi all, 

 

I have a workflow which creates an item in SharePoint list when an email is received to a shared mailbox. 

I need to remove the delete option in the list, which I have tried to do with permissions and it works for a couple of days and then the permissions stop working. 

To solve this, I would like to create a workflow to reverse the deletion of an item essentially. 

So when an item is deleted, get the item and recreate it in the list. 

 

So far I have a flow as follows: 

 

- When an item is deleted

- Get changes for an item or file (properties only)

- Send an HTTP request to SharePoint

- Compose

 

The flow fails at the second step, I assume because the item is deleted it can't find the item. 

 

Any help much appreciated!

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @jjcook,

     

    The item will be in the recycle bin. You can find it with some filtering in the recycle bin. When you have found a match you can use its id to restore it again with the restore method.

     

    Below is an example

     

    1. URI to filter on LeafName and Title of the list item

    _api/web/RecycleBin?$filter=startswith(LeafName,'@{triggerOutputs()?['body/ID']}') and Title eq '@{triggerOutputs()?['body/Name']}'

     

    2. URI to restore the first item found in the previous HTTP request:

    _api/web/RecycleBin('@{first(outputs('Send_an_HTTP_request_to_SharePoint')?['body']['value'])['Id']}')/Restore

     

     

    recyclebin.png

  • jjcook Profile Picture
    30 on at

    Hi there, 

     

    Thank you so much for your help. I really appreciate it. 

    Unfortunately I haven't managed to make it work, could you kindly let me know what I am doing wrong. I have attached my workflow below. Apologies, I am very new to this!

     

    Thanks again. 

  • Verified answer
    Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @jjcook,

     

    You are missing the Headers in both HTTP request actions.

     

    Please add the nometadata Headers to the Headers field of the first action. (Switch to text mode with the T button on the right side to be able to copy past the below).

     

    {
     "Accept": "application/json;odata=nometadata",
     "Content-Type": "application/json;odata=nometadata"
    }

     

     

    And I used the verbose Headers in the Headers field of the second HTTP request (which restores the item)

     

    {
     "Accept": "application/json;odata=verbose",
     "Content-Type": "application/json;odata=verbose"
    }

     

     

  • jjcook Profile Picture
    30 on at

    Thanks so much for your help!

  • jjcook Profile Picture
    30 on at

    Hi there! Thanks again for your help above, it has been such a great help to me. During testing, I have found that the flows run successfully if I delete an item from the list, however if someone else deletes an item from the list the flow doesn't work. 
    I cannot see why this is the case, do you have any ideas as to why this would be happening?
    Any help greatly appreciated. 

    Thank you, 


    Jess

  • jjcook Profile Picture
    30 on at

    Hey there! Is there any chance you would be able to help me with the reply I sent below? 

     

     

    'Hi there! Thanks again for your help above, it has been such a great help to me. During testing, I have found that the flows run successfully if I delete an item from the list, however if someone else deletes an item from the list the flow doesn't work. 
    I cannot see why this is the case, do you have any ideas as to why this would be happening?
    Any help greatly appreciated. '

     

    Would really appreciate help on this. Thank you in advance!

    Jess

  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @jjcook,

     

    Is the account used in the connection of the SharePoint action site collection admin of the site?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard