Power Automate - Read files from SharePoint directory
Power Automate - Read files from SharePoint directory
Overview
- get the file properties
- iterate over the files
- read the content
- take action with the content
Get file properties
To find only files in a directory, use the SharePoint Get files (properties only)
action with the FilterQuery set to FSObjType eq 0
:
In code view:
{
"inputs": {
"host": {
"connectionName": "shared_sharepointonline",
"operationId": "GetFileItems",
"apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline"
},
"parameters": {
"dataset": "OBFUSCATED",
"table": "OBFUSCATED",
"folderPath": "@outputs('Compose_full_folder_path')",
"viewScopeOption": "Default",
"$filter": "FSObjType eq 0",
"view": "OBFUSCATED"
},
"authentication": {
"type": "Raw",
"value": "@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"
}
},
"metadata": {
"operationMetadataId": "41ec4337-2e5a-49b1-9f06-0eb152ddf4ad"
}
}
Iterate over files and read content
The Apply to each
action is applied to the following data:
outputs('Get_files_(properties_only)')?['body/value']
The code view of the Get file content
action looks like this:
{
"inputs": {
"host": {
"connectionName": "shared_sharepointonline",
"operationId": "GetFileContent",
"apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline"
},
"parameters": {
"dataset": "OBFUSCATED",
"id": "@items('Apply_to_each')?['{Identifier}']",
"inferContentType": true
},
"authentication": {
"type": "Raw",
"value": "@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"
}
},
"metadata": {
"operationMetadataId": "6dcd37b2-92e6-4496-9621-c0f3a7c9f179"
}
}
See also
- PowerPlatform - Connectors - SharePoint
- How to get files from specific SharePoint folders in Power Automate
- Use OData query operations in SharePoint REST requests
- SharePoint OData Filter query in Get items actions in Power Automate
- FileSystemObjectType enumeration
- In-depth analysis into Get items and Get files SharePoint actions for flows in Power Automate
- How to Get Only Files (and Exclude Folders) from a SharePoint Document Library Using Power Automate