我可以使用哪些操作通过 Azure 逻辑应用程序在 SharePoint Online 中创建文件夹?
Which action(s) can I use to create a folder in SharePoint Online via Azure Logic App?
如问题标题所述,我正在逻辑应用程序中寻找适当的操作来创建文件夹。此操作将执行多次——根据业务规则每个目录执行一次。这些文件夹中不会创建任何文件,因为逻辑应用程序的目的是为用户的需要准备一个模板文件夹结构。
在官方文档中我看到有 create file, create item, and list folder 个动作。他们建议 可能 也可以创建一个文件夹(我找不到)。
如果不存在这样的操作,我可能需要使用一些 SharePoint Online API,但这将是不得已的解决方案。
正确,目前 SharePoint 连接器不支持文件夹管理任务。
因此,您当前的最佳选择是在 API 或函数应用程序中使用 SharePoint API 或客户端库。
我能够通过 SharePoint - CreateFile action. Creating a directory via a side effect of the file creation action is definitely a dirty hack (btw, inspired by a comment on MS suggestion site) 创建目录。 bug/feature 没有记录,因此在生产环境中依赖它可能不是一个好主意。
此外,如果我的问题需要在 SharePoint 中创建一个没有任何文件的目录,则需要在 App Logic 中使用一个额外的步骤。确保使用 Create File
操作提供的 Id
删除文件。
如果您尝试在 preexisting TestTarget
文档库下创建一个名为 folderCreatedAsSideEffect
的目录,那么您的 JSON 可能是这样的.
"actions": {
"Create_file": {
"inputs": {
"body": "@triggerBody()?['Name']",
"host": { "connection": { "name": "@parameters('$connections')['sharepointonline']['connectionId']" } },
"method": "post",
"path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://MY.sharepoint.com/LogicApps/'))}/files",
"queries": {
"folderPath": "/TestTarget/folderCreatedAsSideEffect",
"name": "placeholder"
}
},
"runAfter": {},
"type": "ApiConnection"
},
"Delete_file": {
"inputs": {
"host": { "connection": { "name": "@parameters('$connections')['sharepointonline']['connectionId']" } },
"method": "delete",
"path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://MY.sharepoint/LogicApps/'))}/files/@{encodeURIComponent(body('Create_file')?['Id'])}"
},
"runAfter": {
"Create_file": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},
如问题标题所述,我正在逻辑应用程序中寻找适当的操作来创建文件夹。此操作将执行多次——根据业务规则每个目录执行一次。这些文件夹中不会创建任何文件,因为逻辑应用程序的目的是为用户的需要准备一个模板文件夹结构。
在官方文档中我看到有 create file, create item, and list folder 个动作。他们建议 可能 也可以创建一个文件夹(我找不到)。
如果不存在这样的操作,我可能需要使用一些 SharePoint Online API,但这将是不得已的解决方案。
正确,目前 SharePoint 连接器不支持文件夹管理任务。
因此,您当前的最佳选择是在 API 或函数应用程序中使用 SharePoint API 或客户端库。
我能够通过 SharePoint - CreateFile action. Creating a directory via a side effect of the file creation action is definitely a dirty hack (btw, inspired by a comment on MS suggestion site) 创建目录。 bug/feature 没有记录,因此在生产环境中依赖它可能不是一个好主意。
此外,如果我的问题需要在 SharePoint 中创建一个没有任何文件的目录,则需要在 App Logic 中使用一个额外的步骤。确保使用 Create File
操作提供的 Id
删除文件。
如果您尝试在 preexisting TestTarget
文档库下创建一个名为 folderCreatedAsSideEffect
的目录,那么您的 JSON 可能是这样的.
"actions": {
"Create_file": {
"inputs": {
"body": "@triggerBody()?['Name']",
"host": { "connection": { "name": "@parameters('$connections')['sharepointonline']['connectionId']" } },
"method": "post",
"path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://MY.sharepoint.com/LogicApps/'))}/files",
"queries": {
"folderPath": "/TestTarget/folderCreatedAsSideEffect",
"name": "placeholder"
}
},
"runAfter": {},
"type": "ApiConnection"
},
"Delete_file": {
"inputs": {
"host": { "connection": { "name": "@parameters('$connections')['sharepointonline']['connectionId']" } },
"method": "delete",
"path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://MY.sharepoint/LogicApps/'))}/files/@{encodeURIComponent(body('Create_file')?['Id'])}"
},
"runAfter": {
"Create_file": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},