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 / HTTP Request to Delete...
Power Automate
Unanswered

HTTP Request to Delete Sharepoint file

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Howdy!

 

I am trying to delete a specific file on Sharepoint using the "Send HTTP Request" in order to force delete a file that is checked out or locked. I found a method at this link but I am unable to get it to work (error message below). I even went down through the comments to try the DELETE method and still was not successful.

 

I also found a similar thread on this forum, but it looks like the OP never responded back. 

 

Error Message: The expression "web/GetFileByServerRelativeUrl(‘/sites/TexasRegion/Shared Documents/General/General/Projects/AXONOpenOrders.CSV’)" is not valid.
clientRequestId: aca349fc-7dca-4816-8f43-9843a19fcc20
serviceRequestId: 24b820a0-4084-c000-bd5a-350d5e055e85

 

Current flow:

gcwilliams073_1-1644860533787.png

 

 

Any help would be more than appreciated, thanks!

Categories:
I have the same question (0)
  • mhemphill-wiley Profile Picture
    48 on at

    This took me FOREVER to figure out but here it is!

     

    mhemphillwiley_2-1654693902138.png

     

    The URI is: _api/web/GetFolderByServerRelativeUrl('Folder Name')/Files('DisplayName'). No slash before the Folder Name, and use the Display Name instead of Name (which includes the folder name for some reason). The "bypass-shared-lock" is to get around if the file is locked or checked out, I think. Note that this permanently deletes the file, it won't be in the Recycle bin.

  • efeewfew Profile Picture
    302 on at

    Thanks!

    I needed this 🙂 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I was with a similar problem, but I was dealing with subfolders, then I wrote the following, using dynamic fields

     

    SendHTTPrequestDeleteLockFiles.jpg

     

     

     

    Writing here the Uri expression:
    _api/web/GetFolderByServerRelativeUrl('@{triggerOutputs()?['body/{Path}']}')/Files('@{triggerOutputs()?['body/{FilenameWithExtension}']}')

     

    Don't forget the single quotes, even when using dynamic fields!!

     

    Thank you for useful discussion

  • jerome18 Profile Picture
    24 on at

    Thanks @mhemphill-wiley and @Anonymous, I needed to receive the filename from an email to delete a specific file and you showed me how to do it. As you can see, i only did a concat to specify the required file path and filename from compose actions : concat('/',outputs('repertoire'),'/',outputs('fichier'))

     

    delete_file_sharepoint.JPG

    Many thanks to both of you

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 469

#3
11manish Profile Picture

11manish 364

Last 30 days Overall leaderboard