You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用SharePoint 2.0端点实现JSON Batching创建文件夹?

问题:SharePoint 2.0端点JSON批量创建文件夹及子文件夹失败
  • 需求:通过JSON批量处理结合SharePoint 2.0端点,单次请求完成文件夹及子文件夹的层级创建;需同时兼容API 1.0操作(如创建站点,该操作不被Graph API支持)和2.0操作(如获取文件夹内容、上传文件等),因此必须使用SharePoint端点而非Graph API。
  • 当前测试结果:使用Graph API批量端点https://graph.microsoft.com/v1.0/$batch时,请求体可成功执行并返回201状态码;但使用SharePoint 2.0批量端点https://[TENANT].sharepoint.com/_api/v2.0/$batch时,返回400错误。
  • 当前使用的请求体:
[
  {
    "headers": {
      "Content-Type": "application/json",
      "Accept": "application/json"
    },
    "body": {
      "@microsoft.graph.conflictBehavior": "fail",
      "folder": {}
    },
    "url": "/sites/[SITE_ID]/drive/items/[ROOT_FOLDER_ID]:/Opportunità Latrinett",
    "method": "PATCH",
    "id": 1
  },
  {
    "headers": {
      "Content-Type": "application/json",
      "Accept": "application/json"
    },
    "body": {
      "@microsoft.graph.conflictBehavior": "fail",
      "folder": {}
    },
    "url": "/sites/[SITE_ID]/drive/items/[ROOT_FOLDER_ID]:/Opportunità Latrinett/Items",
    "method": "PATCH",
    "id": 2,
    "dependsOn": [ "1" ]
  },
  {
    "headers": {
      "Content-Type": "application/json",
      "Accept": "application/json"
    },
    "body": {
      "@microsoft.graph.conflictBehavior": "fail",
      "folder": {}
    },
    "url": "/sites/[SITE_ID]/drive/items/[ROOT_FOLDER_ID]:/Opportunità Latrinett/Items/Master Folder",
    "method": "PATCH",
    "id": 3,
    "dependsOn": [ "2" ]
  },
  {
    "headers": {
      "Content-Type": "application/json",
      "Accept": "application/json"
    },
    "body": {
      "@microsoft.graph.conflictBehavior": "fail",
      "folder": {}
    },
    "url": "/sites/[SITE_ID]/drive/items/[ROOT_FOLDER_ID]:/Opportunità Latrinett/Preventivi",
    "method": "PATCH",
    "id": 4,
    "dependsOn": [ "3" ]
  }
]

内容的提问来源于stack exchange,提问作者Christian Croce

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 11:02:08