Im creating a Power Automate flow to Pick File from Local Folder, Data Gateway and Connector are also set.
-----------------------------------------
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"
}