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 Automate
Unanswered

Delete API Sharepoint

(0) ShareShare
ReportReport
Posted on by 115

Hi,

I am trying to delete a file version history using Delete API.
The flow is success. but how i can retrieve the deleted file? it did not go to recycle bin / 2nd stage recycle bin.
It has been deleted permanently.

is there a way to move it to recycle bin or copy the file history version before deleting?


 

{
 "d": {
 "__metadata": {
 "id": "https://xxxx.sharepoint.com/sites/xxxx/_api/web/GetFolderByServerRelativeUrl('Digital Sharing/')/Files('Test.xlsx')/Versions(2048)",
 "uri": "https://xxxx.sharepoint.com/sites/xxxx/_api/web/GetFolderByServerRelativeUrl('Digital%20Sharing/')/Files('Test.xlsx')/Versions(2048)",
 "type": "SP.FileVersion"
 },
 "CreatedBy": {
 "__deferred": {
 "uri": "https://xxxx.sharepoint.com/sites/xxxx/_api/web/GetFolderByServerRelativeUrl('Digital%20Sharing/')/Files('Test.xlsx')/Versions(2048)/CreatedBy"
 }
 },
 "CheckInComment": "",
 "Created": "2021-09-07T06:39:14Z",
 "ID": 2048,
 "IsCurrentVersion": false,
 "Length": "14672",
 "Size": 14672,
 "Url": "_vti_history/2048/Digital Sharing/Test.xlsx",
 "VersionLabel": "4.0"
 }
}

 



pityman_0-1632286226596.png

 

Thank you


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

    Hi @pityman,


    I have tried a couple of workarounds:

    - Recycle method of a file. This only works for the whole File, not a specific version

    - Using a POST request with the deleteobject method instead  of a DELETE request, in this example the file version is deleted and not stored in the recycle bin.

     

    So, by the looks of it you are running into a limitation of the REST API.

     

    I also had a look at the user interface. When the file version is deleted over there the SharePoint application is interacting with the versions.aspx page. Might be worth investigating if you can interact with that page instead of the REST API. 

     

     

  • pityman Profile Picture
    115 on at

    Thank you for your reply.

    I am trying to find any alternative ways to save the file before deletion.
    i have the url/link for the file history . Is there anyway to save the file to somewhere using the link below?
    When i copy the link to browser, i am able to select a file location to save the file. not sure if i can do it automatically using flow
    https://xxx.sharepoint.com/sites/xxx/xxx/_vti_history/512/xxx/Test/Book.xlsx

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard