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

HTTP Request to Delete Sharepoint file

(0) ShareShare
ReportReport
Posted on by

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

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

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard