How to Create a Document Library in SharePoint Online? Easily
SharePoint users are increasing day by day because of its latest and robust features. However, one of its older features, which is heavily used and for SharePoint is well- known, is the document library. SharePoint offers multiple options to create document libraries for data management. But not knowing how to create a document library in SharePoint Online means missing out on one of SharePoint’s most crucial features.
In this article, we will discuss how to create document libraries using numerous methods. You will get to know about the SharePoint admin center steps, PowerShell commands, and Power Automate method as well. So, let’s start discussing.
Table of Content
Method 1. How to Make a New Document Library in SharePoint Online?
One of the simple ways is to go to the site where you want to add the document library. Then follow the below steps to get the answer to your query on how to create a document library in SharePoint Online from a blank library.
- Open the Site’s homepage, and click on the New option.
- Choose Document Library > Blank Library.
- Choose a name and description for the document library.
- Finally, hit the Create button to create the document library.
Method 2. Create a New Document Library From an Existing SharePoint Library
If you want to create a document library from the existing one, then you can go with the below steps.
- Move to the Homepage of the SharePoint site > New.
- Select the option of Document Library > From Existing Library.
- Now from the opened screen, choose the SharePoint site and the document library that you want to copy.
- After that hit the Next button, and allocate a necessary name and description of the created document library.
- Lastly, hit on the Create button to create a second document library.
Method 3. Create Document Library Using Templates in SharePoint Online
SharePoint provides inbuilt templates for document libraries. You can also use them to create a document library in SharePoint Online if required. But do not forget to implement the SharePoint document management best practices while creating a new one.
- After choosing the Document Library option from the Site’s homepage.
- Select the Template that you want to use.
- From the next screen, you can see the preview of the template. Choose the Use Template option.
- Select a suitable name for the document library.
- You can also choose the additional features if required or also skip them.
Method 4. How to Create a Document Library in SharePoint Online with the Help of PowerShell Commands?
If you are a PowerShell enthusiast and always want to automate the tasks through the scripts. Then this method will be best suited for you. Execute the below commands but remember to follow them sequentially to get the expected results.
#Import SharePoint Online PowerShell Module Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking Function Create-New-DocumentLibrary() { param ( [Parameter(Mandatory=$true)] [string] $URL_ofSite, [Parameter(Mandatory=$true)] [string] $DocLibName ) Try { $Cred = Get-Credential $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($URL_ofSite) $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password) $Lists = $Ctx.Web.Lists $Ctx.Load($Lists) $Ctx.ExecuteQuery() if(!($Lists.Title -contains $DocLibName)) { $List-Info = New-Object Microsoft.SharePoint.Client.ListCreationInformation $List-Info.Title = $DocLibName $List-Info.TemplateType = 101 $List = $Ctx.Web.Lists.Add($List-Info) $List.Update() $Ctx.ExecuteQuery() write-host -f Green "Your New SharePoint Document Library is created to use!" } else { Write-Host -f Yellow "List or Library '$DocLibName' already exists in SharePoint site!" } } Catch { write-host -f Red "Error while Creating the Document Library!" $_.Exception.Message } } $URL_ofSite= "complete URL" $DocLibName="Sales" Create-New-DocumentLibrary -URL_ofSite $URL_ofSite -DocLibName $DoctLibName
Method 5. How to Create a New Document Library in SharePoint Online Using Power Automate?
Suppose you are comfortable with Power Automate and have previous experience performing tasks using it. Then below are quick steps that can create the document library.
1. Open the MS Power Automate.
2. Create a new Power Automate workflow.
3. Choose Action as Send an HTTP request to SharePoint.
4. Provide the required details such as:-
Site Address – > URL of SharePoint site..
Method -> POST
Uri -> _api/web/lists
Header -> content-type
Headers Value: application/json;odata=verbose
Body: {
“BaseTemplate”: 101,
“Description”: “This is a SharePoint Document Library for storing documents related to our clients.”,
“Title”: “Client Documents”
}
5. Click on the Test Flow > I‘ll perform the trigger action and hit Test.
6. Hit on Continue and then verify the document library from the SharePoint site.
How to Create Multiple Document Libraries in SharePoint Online?
All the above methods can create a single document library. But for creating multiple document libraries the steps need to be executed repeatedly. So, to avoid the repetition of the steps, you can use the below script to create multiple document libraries in SharePoint Online in an automated way.
#Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" Function Create-Multiple-DocumentLibraries() { [cmdletbinding()] param ( [Parameter(Mandatory=$True,ValueFromPipeline)] [String[]] $NamesofLibrary, [Parameter(Mandatory=$False)] [String] $Desc ) Try { ForEach($NameofLibrary in $NamesofLibrary) { Write-host -f Yellow "`nEnsuring Document Library '$NameofLibrary'" $Lists = $Web.Lists $Ctx.Load($Lists) $Ctx.ExecuteQuery() If(!($Lists.Title -contains $NameofLibrary)) { #Create a new Document Library $ListInfo = New-Object Microsoft.SharePoint.Client.ListCreationInformation $ListInfo.Title = $NameofLibrary $ListInfo.Description = $Desc $ListInfo.TemplateType = [Microsoft.SharePoint.Client.ListTemplateType]::DocumentLibrary $Web.Lists.Add($ListInfo) | Out-Null $Ctx.ExecuteQuery() write-host -f Green "`tNew Document Library is ready to use!" } Else { Write-Host -f Magenta "`t this named document library already exists, choose another name!" } } } Catch { write-host -f Red "`tError:" $_.Exception.Message } } $URLofSite= "complete site URL" $Cred = Get-Credential $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($URLofSite) $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password) $Web = $Ctx.web $Ctx.Load($Web) $Ctx.executeQuery() Create-Multiple-DocumentLibraries -NamesofLibrary @("Document Library Sales", "Document Library Invoice", "Document Library TechProject", "Document Library Employee_Details")
Is Migration of Document Libraries Possible?
Yes, if your organization wants to perform SharePoint migration and you as an administrator, are unaware of the fact that the document libraries can also migrated. So, don’t fret you can copy document library to another SharePoint site using the SharePoint Migrator. This tool not only migrates the SharePoint document libraries but also the sites and lists as well. It can accomplish the complete migration process with the 5 simple steps and these are.
- Installation of the tool.
- Finalizing the Source and Destination platforms.
- Select Sites and their associated document libraries.
- Completing the details of both platforms.
- Fetch Sites and Users. Finally, start migration.
Conclusion
In this article, we have explained the different methods to create document libraries in SharePoint. Now you can choose any of the methods as per your technical expertise. Make sure the chosen method is performed in the correct way to get the right results. Hence the query on how to create a document library in SharePoint Online has been resolved.