我有一个场景,其中共享点中有多个父文件夹,这些文件夹包含多个嵌套或子文件夹,然后有一个文件。我如何通过使用 Logic 应用程序维护 Sharepoint 中相同的文件夹结构来将这些文件复制到 blob。
我在 SharePoint 的
Test/demo/demo1
文件夹中有文件。
我正在使用以下工作流程通过保持文件夹结构完整来将这些文件复制到 Blob 存储。
代码-
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"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": "/samples-workitems",
"name": "@items('For_each')?['Path']",
"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')?['Path']",
"queryParametersSingleEncoded": true
}
},
"type": "ApiConnection"
}
},
"foreach": "@body('List_folder')",
"runAfter": {
"List_folder": [
"SUCCEEDED"
]
},
"type": "Foreach"
},
"List_folder": {
"inputs": {
"host": {
"connection": {
"referenceName": "sharepointonline"
}
},
"method": "get",
"path": "/datasets/@{encodeURIComponent(encodeURIComponent('*********'))}/folders/@{encodeURIComponent('%252fTest%252fdemo%252fdemo1')}"
},
"metadata": {
"%252fTest": "/Test",
"%252fTest%252fdemo%252fdemo1": "/Test/demo/demo1"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"triggers": {
"When_a_HTTP_request_is_received": {
"kind": "Http",
"runtimeConfiguration": {
"concurrency": {
"runs": 1
}
},
"type": "Request"
}
}
},
"kind": "Stateful"
}
输出-