0

I want to create nested folders in document library using rest api with single call.

I have project Name with that I want to create a folder in document library, in side project name folder I want to create individual folders for each month(Jan-December).

Presently I am using for loop to achieve this requirement,Please guide me alternate approach like in first call I will create a folder for project name in success of that method I will call remaining 12 folders in single call.

Thanks in advance.

1 Answers1

0

The SharePoint 2013 REST service support making batch requests with the REST APIs. Here is an example for your reference:

POST https://fabrikam.sharepoint.com/_api/$batch HTTP/1.1
Authorization: Bearer <access token omitted>
Content-Type: multipart/mixed; boundary=batch_e3b6819b-13c3-43bb-85b2-24b14122fed1
Host: fabrikam.sharepoint.com
Content-Length: 527
Expect: 100-continue

--batch_e3b6819b-13c3-43bb-85b2-24b14122fed1
Content-Type: application/http
Content-Transfer-Encoding: binary

GET https://fabrikam.sharepoint.com/_api/Web/lists/getbytitle('Composed%20Looks')/items?$select=Title HTTP/1.1

--batch_e3b6819b-13c3-43bb-85b2-24b14122fed1
Content-Type: application/http
Content-Transfer-Encoding: binary

GET https://fabrikam.sharepoint.com/_api/Web/lists/getbytitle('User%20Information%20List')/items?$select=Title HTTP/1.1

--batch_e3b6819b-13c3-43bb-85b2-24b14122fed1--

More detail about batch request with REST please refer here.

Fei Xue
  • 14,369
  • 1
  • 19
  • 27