Hello Rayne,
Thank you for posting your query here!
You may refer the below Logic app workflow to get the libraries and lists from SharePoint and then iterate over each library and lists. Lastly uploading the files to Blob storage.
Workflow:
Code:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"For_each_1": {
"actions": {
"Condition": {
"actions": {
"Create_blob_(V2)": {
"inputs": {
"body": "@body('Get_file_content_using_path')",
"headers": {
"ReadFileMetadataFromServer": true
},
"host": {
"connection": {
"referenceName": "azureblob"
}
},
"method": "post",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files",
"queries": {
"folderPath": "/demo-container",
"name": "@{items('For_each_1')?['{FullPath}']}",
"queryParametersSingleEncoded": true
}
},
"runAfter": {
"Get_file_content_using_path": [
"SUCCEEDED"
]
},
"runtimeConfiguration": {
"contentTransfer": {
"transferMode": "Chunked"
}
},
"type": "ApiConnection"
},
"Get_file_content_using_path": {
"inputs": {
"host": {
"connection": {
"referenceName": "sharepointonline"
}
},
"method": "get",
"path": "/datasets/@{encodeURIComponent(encodeURIComponent('*************'))}/GetFileContentByPath",
"queries": {
"inferContentType": true,
"path": "@{items('For_each_1')?['{FullPath}']}",
"queryParametersSingleEncoded": true
}
},
"type": "ApiConnection"
}
},
"else": {
"actions": {}
},
"expression": {
"and": [
{
"equals": [
"@items('For_each_1')?['{isFolder}']",
false
]
}
]
},
"type": "If"
}
},
"foreach": "@body('Get_items_')?['value']",
"runAfter": {
"Get_items_": [
"SUCCEEDED"
]
},
"type": "Foreach"
},
"Get_items_": {
"inputs": {
"host": {
"connection": {
"referenceName": "sharepointonline"
}
},
"method": "get",
"path": "/datasets/@{encodeURIComponent(encodeURIComponent('*************'))}/tables/@{encodeURIComponent(encodeURIComponent(items('For_each')?['DisplayName']))}/items",
"queries": {
"viewScopeOption": "RecursiveAll"
}
},
"type": "ApiConnection"
}
},
"foreach": "@body('Get_all_lists_and_libraries')?['value']",
"runAfter": {
"Get_all_lists_and_libraries": [
"SUCCEEDED"
]
},
"type": "foreach"
},
"Get_all_lists_and_libraries": {
"inputs": {
"host": {
"connection": {
"referenceName": "sharepointonline"
}
},
"method": "get",
"path": "/datasets/@{encodeURIComponent(encodeURIComponent('***********'))}/alltables"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"triggers": {
"When_a_HTTP_request_is_received": {
"kind": "Http",
"type": "Request"
}
}
},
"kind": "Stateful"
}