i need to use the JSON Batching() with the Sharepoint 2.0 endpoints () in order to create folders and subfolders with only a callout.
i'm using this request body: using this body:
[ {
"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" ]
} ]
Which endpoint is correct, in order to use Sharepoint 2.0 and not the Graph API? I know these two are the same functionality, but i need to use the former in order to handle API 1.0 callouts (creating sites is not supported by the Graph API) and 2.0 (get folder content, upload file, etc.)
using this URL: https://[TENANT].sharepoint/_api/v2.0/$batch returns 400:The request is malformed or incorrect, but if i use .0/$batch, the callout works, returns 201 and creates the folders
i need to use the JSON Batching(https://learn.microsoft/en-us/graph/json-batching) with the Sharepoint 2.0 endpoints (https://learn.microsoft/en-us/sharepoint/dev/apis/sharepoint-rest-graph) in order to create folders and subfolders with only a callout.
i'm using this request body: using this body:
[ {
"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" ]
} ]
Which endpoint is correct, in order to use Sharepoint 2.0 and not the Graph API? I know these two are the same functionality, but i need to use the former in order to handle API 1.0 callouts (creating sites is not supported by the Graph API) and 2.0 (get folder content, upload file, etc.)
using this URL: https://[TENANT].sharepoint/_api/v2.0/$batch returns 400:The request is malformed or incorrect, but if i use https://graph.microsoft/v1.0/$batch, the callout works, returns 201 and creates the folders
Share Improve this question edited Feb 11 at 8:27 Christian Croce asked Feb 10 at 16:25 Christian CroceChristian Croce 11 bronze badge 1- Please provide enough code so others can better understand or reproduce the problem. – Community Bot Commented Feb 11 at 4:56
1 Answer
Reset to default 0Please try to run the following request using the MS Graph API first to see if you can get the corresponding SharePoint v2.0 bath request.
The response will then include the underlying SharePoint URL, such as: https://{tenant-name}.sharepoint/_api/v2.0/xxxx
If there is no corresponding return, it is likely that SharePoint v2.0 endpoint does not support JSON Batching yet.
https://graph.microsoft/v1.0/$batch?whatin
You can send this request using this MS Graph online api request tool (please login to your tenant's account first)