Forum Discussion

NaleyKaran's avatar
NaleyKaran
Copper Contributor
Apr 09, 2023

Create Multiple Document Libraries Using SharePoint HTTP Request

Hello,

 

I was wondering if anyone knows how to create multiple libraries using SharePoint HTTP request.

 

This is a case:

I want to create a SharePoint site which has 7 document libraries(This names are already known).

I also want to have several folders in some of those document libraraires.

 

I already know how to create a SharePoint site and a single document library and a single folder in that library by using  the SharePoint HTTP request.

 

However, I don't know how to create multiple document libraries.

 

Imagine we have a list of document libraries such as:

Library 1

Library 2

Library 3

Library 4

Library 5

 

and

Library 1 has 2 folders which are: Folder 1 and Folder 2.

 

1 Reply

  • Hi NaleyKaran,

     

    With the Microsoft Graph API, you are able to do so! Use the Lists EndPoint to create the new Library, but instead of the ‘genericList’ template, use the ‘documentLibrary’ template.

     

    Furthermore, there is also a Create Folder endpoint which you can use to create and populate the folder structure.

     

    Links for reference;

    • https://learn.microsoft.com/en-us/graph/api/list-create?view=graph-rest-1.0&tabs=http
    • https://learn.microsoft.com/en-us/graph/api/driveitem-post-children?view=graph-rest-1.0&tabs=http


    Good luck!

     

    https://www.linkedin.com/in/mverwijmeren 

Resources