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 / Filename in HTTP reque...
Power Automate
Answered

Filename in HTTP request to SharePoint and Rest API

(1) ShareShare
ReportReport
Posted on by 39
I want to check out a file in a SharePoint library using Power Automate (HTTP request to SharePoint and Rest API)
 
It works when I hardcode the filename. Ex. _api/web/GetFileByServerRelativeUrl('/sites/TheSite/TheLibrary/filename.docx')/CheckOut() 
 
However when I add the filename dynamically in the following way (and others ways that I also tried), the filename is not displayed. The filename exists because I'm able to write it to a column of the library. Your help would be appreciated :)

Categories:
I have the same question (0)
  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at
    Hi
     
    Couple of ways you could debug this.
     
    Add a compose above the http step. Map the fileName under the compose. Run the flow and check the run history. Expand the compose and see whether the filename appears or not. Next check where the fileName getting from. Expand that step and see why fileName is not appearing. Most likely it must be a folder. In that case you need to check whether its not a folder or not using an IF condition. I can only suggest the IF condition if you could post a screenshot of your flow. That will be helpful to determine what's going.
     
    Thanks
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
    Hi
     
    Yeah I would validate that the filename has the extension. As I cannot see your flow etc, not sure that it does, or how you are gathering the information pre-post action, if you can share your flow too.

    You can also, go into your Flow History, pick one of the runs that you rested, where the variable was being used. You can go to the action itself, and see what was the URL that it generated fully.

    Copy it out. Make sure the extension is there. Make sure there are no spaces unintentionally, as you might have to add a trim() etc.
  • KTNN0 Profile Picture
    39 on at
    Thank you for your help. I simplied the flow to concentrate on the issue. The flow is triggered manually on a SharePoint file. Then it adds the filename to the Title properties. I added the compose also just to show that the filename with the extension exists, as suggested. And finally at the HTTP request, where the filename is not displayed.
    Compose:
    HTTP Request:
  • KTNN0 Profile Picture
    39 on at
    And if I hard code the name of the file, it works. The file is checked out.
     
     
  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at
    Hi
     
     
    So I have tested this and you need to encode the uri.
     
    Here are the steps:
     
  • Suggested answer
    SaiRT14 Profile Picture
    1,990 Super User 2025 Season 2 on at
    Follow the below steps and let me know: 
    • Trigger the flow (e.g., when a file is created or modified).
    • Add an action to get the file properties if needed.
    Use the HTTP Request to SharePoint action in Power Automate to send the request.
    _api/web/GetFileByServerRelativeUrl('@{encodeUriComponent(triggerOutputs()?['body/{Path}'])}')/CheckOut()
     
    Headers:  Ensure that the headers are set properly for the API request:
    • Accept: application/json;odata=verbose
    • Content-Type: application/json;odata=verbose
    _api/web/GetFileByServerRelativeUrl('@{triggerOutputs()?['body/{Path}']}')/CheckOut()
     
     
     

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

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard