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 / Error while using Get ...
Power Automate
Suggested Answer

Error while using Get File Content using Path

(2) ShareShare
ReportReport
Posted on by 6
Im creating a Power Automate flow to Pick File from Local Folder, Data Gateway and Connector are also set.
 
but getting error at Stage 5

-----------------------------------------

I have tried all blank & both slash format('','/','\') in the below Expression for stage 5

--------------------------------------------------

//Expression

if(

    empty(outputs('CleanSubFolder')),

    concat('/', outputs('CleanFileName')),

    concat( '/',outputs('CleanSubFolder'), '/', outputs('CleanFileName'))

)

-----------------------------------------------------------

Workflow Steps

-----------------------------------------------------------
step 1:
{
  "type": "Request",
  "kind": "Http",
  "inputs": {
    "triggerAuthenticationType": "All",
    "schema": {
      "type": "object",
      "properties": {
        "FileName": {
          "type": "string"
        },
        "SubFolder": {
          "type": "string"
        }
      },
      "required": [
        "FileName"
      ]
    }
  },
  "metadata": {
    "operationMetadataId": "e6737c64-cb70-4ea9-82b3-a629752b6c52"
  }
}
step 2 CleanFileName:
{
  "type": "Compose",
  "inputs": "@trim(\r\n    replace(\r\n        replace(\r\n            coalesce(triggerBody()?['FileName'], ''),\r\n            decodeUriComponent('%0D'),\r\n            ''\r\n        ),\r\n        decodeUriComponent('%0A'),\r\n        ''\r\n    )\r\n)",
  "runAfter": {},
  "metadata": {
    "operationMetadataId": "6c97c73d-af97-4ae7-8d41-0f56313f62a1"
  }
}
step 3 CleanSubFolder:
{
  "type": "Compose",
  "inputs": "@trim(\r\n    replace(\r\n        replace(\r\n            coalesce(triggerBody()?['SubFolder'], ''),\r\n            decodeUriComponent('%0D'),\r\n            ''\r\n        ),\r\n        decodeUriComponent('%0A'),\r\n        ''\r\n    )\r\n)",
  "runAfter": {
    "CleanFileName": [
      "Succeeded"
    ]
  },
  "metadata": {
    "operationMetadataId": "8ad8aa83-c211-40df-9002-9998dd53488a"
  }
}
step 4 FinalPath:
{
  "type": "Compose",
  "inputs": "@if(\r\n    empty(outputs('CleanSubFolder')),\r\n    concat('/', outputs('CleanFileName')),\r\n    concat('/', outputs('CleanSubFolder'), '/', outputs('CleanFileName'))\r\n)",
  "runAfter": {
    "CleanSubFolder": [
      "Succeeded"
    ]
  },
  "metadata": {
    "operationMetadataId": "2b6aba48-55c5-4821-8a23-baa4666d76c3"
  }
}
step 5:
{
  "type": "OpenApiConnection",
  "inputs": {
    "parameters": {
      "path": "@outputs('FinalPath')",
      "inferContentType": true
    },
    "host": {
      "apiId": "/providers/Microsoft.PowerApps/apis/shared_filesystem",
      "connection": "shared_filesystem_1",
      "operationId": "GetFileContentByPath"
    }
  },
  "runAfter": {
    "FinalPath": [
      "Succeeded"
    ]
  },
  "metadata": {
    "operationMetadataId": "890caa9c-2a86-4843-9644-dc0b70273140"
  }
}
step 6:
{
  "type": "OpenApiConnection",
  "inputs": {
    "parameters": {
      "dataset": "https://flexsininc.sharepoint.com/sites/Customer_Self_Service_Flexsin",
      "folderPath": "/Shared Documents/Test Power Automate To SharePoint",
      "name": "@outputs('CleanFileName')",
      "body": "@body('Get_file_content_using_path')"
    },
    "host": {
      "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
      "connection": "shared_sharepointonline",
      "operationId": "CreateFile"
    }
  },
  "runAfter": {
    "Get_file_content_using_path": [
      "Succeeded"
    ]
  },
  "runtimeConfiguration": {
    "contentTransfer": {
      "transferMode": "Chunked"
    }
  },
  "metadata": {
    "operationMetadataId": "9dafcc6f-05e1-44f8-993b-db13fca2988b"
  }
}
step 7:
{
  "type": "Response",
  "kind": "Http",
  "inputs": {
    "statusCode": 200,
    "body": {
      "Filename": "@triggerBody()['FileName']",
      "SubFolder": "@triggerBody()?['SubFolder']",
      "SharePointURL": "@outputs('Create_file')?['body/Path']"
    }
  },
  "runAfter": {
    "Create_file": [
      "Succeeded"
    ]
  },
  "metadata": {
    "operationMetadataId": "024a34ce-48f6-4502-b320-5a861db50780"
  }
}

response body:
{
"status": 400,
"message": "The requested action could not be completed. Check your request parameters to make sure the path '\\/TransferOrder.pdf' exists on your file system.\r\nclientRequestId: ca4298cf-e437-4269-97ac-2b93c18ed177",
"error": {
"message": "The requested action could not be completed. Check your request parameters to make sure the path '\\/TransferOrder.pdf' exists on your file system."
},
"source": "filesystem-scus.azconn-scus-001.p.azurewebsites.net"
}

Response Header:
{
"Cache-Control": "no-store, no-cache",
"Pragma": "no-cache",
"Set-Cookie": "ARRAffinity=c16519602f24ea04cc72dc62505b43355770e3e27231e2e17cc35b76103a2502;Path=/;HttpOnly;Secure;Domain=filesystem-scus.azconn-scus-001.p.azurewebsites.net,ARRAffinitySameSite=c16519602f24ea04cc72dc62505b43355770e3e27231e2e17cc35b76103a2502;Path=/;HttpOnly;SameSite=None;Secure;Domain=filesystem-scus.azconn-scus-001.p.azurewebsites.net",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"x-ms-request-id": "ca4298cf-e437-4269-97ac-2b93c18ed177",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "DENY",
"x-ms-connection-gateway-object-id": "50afe134-d5bc-454a-8705-d2bb2cb8b807",
"x-ms-environment-id": "default-0b41e635-4a10-475c-b7b7-bc6862a19e41",
"x-ms-tenant-id": "0b41e635-4a10-475c-b7b7-bc6862a19e41",
"x-ms-subscription-id": "Default-0b41e635-4a10-475c-b7b7-bc6862a19e41",
"x-ms-dlp-re": "-|-",
"x-ms-dlp-gu": "-|-",
"x-ms-dlp-ef": "-|-/-|-|-|-",
"x-ms-mip-sl": "-|-|-|-",
"x-ms-au-creator-id": "02b7848e-c4fa-40ec-8952-d89a6fc3625f",
"Timing-Allow-Origin": "*",
"x-ms-apihub-cached-response": "false",
"x-ms-apihub-obo": "false",
"Date": "Tue, 07 Apr 2026 05:37:13 GMT",
"Content-Length": "497",
"Content-Type": "application/json",
"Expires": "-1"
}
I have the same question (0)
  • 11manish Profile Picture
    3,333 on at
    The error shows:
    • path '\\/TransferOrder.pdf'
    This is invalid because:
    • You’re mixing forward slash / and backslash \
    • The File System connector (via gateway) expects a Windows-style path

    The error occurs because the File System connector in Microsoft Power Automate expects Windows-style paths (\), but your flow is using forward slashes (/), resulting in an invalid path like \/TransferOrder.pdf.
     
    Fix

    Replace / with \ in your expression:
    concat('\', outputs('CleanFileName'))
     
    Also verify
    • Path matches the gateway root folder
    • File actually exists at that location
  • CU30030519-0 Profile Picture
    6 on at
    @11manish thanks for the Reply. These are the other 2 ways that i have tried but getting error.
     
  • Suggested answer
    rezarizvii Profile Picture
    352 on at
    Hi @CU30030519-0, hope you are doing well.
     
    From the screenshots that you shared, I can see your file is at path '\\DESKTOP-U1MOU7A\test_gateway_connection\TransferOrder.pdf' but in your error message, it says the path the action received is '\\/TransferOrder.pdf'.
     
    It seems the connector is not appending the Root folder value to the path.
     
    Could you try appending the Root folder value 'DESKTOP-U1MOU7A\test_gateway_connection' to your FinalPath before appending the rest of the path? It should fix your issue it seems.
     
    Your updated expression should look like this:
    if(

        empty(outputs('CleanSubFolder')),

        concat('DESKTOP-U1MOU7A\test_gateway_connection\', outputs('CleanFileName')),

        concat('DESKTOP-U1MOU7A\test_gateway_connection\', outputs('CleanSubFolder'), '\', outputs('CleanFileName'))

    )
     
    If this reply helped you in any way, please give it a Like 💜 and in case it resolved your issue, please mark it as the Verified Answer ✅.
  • 11manish Profile Picture
    3,333 on at
     
    try to follow  solution
     
     
    but you can try below too.
     
    if(
        empty(outputs('CleanSubFolder')),
        concat('\', trim(outputs('CleanFileName'))),
        concat('\', trim(outputs('CleanSubFolder')), '\', trim(outputs('CleanFileName')))
    )
  • rezarizvii Profile Picture
    352 on at
    Hi @CU30030519-0, hope you are doing well.
     
    Just wanted to check in and see if everything is working now. If you still need any help, feel free to let me know.
    Also, if the issue is resolved, it would be great if you could mark the answer as solved so others with the same question can find it easily.
     
    Thanks and have a great day!

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard