Scripts to create multiple Document Libraries in SharePoint Online.

Anyone got a good techniques tools to create multiple document libararies quickly in SharePoint Online ? I have about 50 I need to bulk create in one site. Powershell ? If so has anyone any tried and trusted scripts ?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
I just can recommend using this custom module:

This should enable you to create the 50 libraries very quickly.

Unfortunately MS has not yet offered a fully flexible Powershell module for SharePoint Online.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jamie McAllister MVPSharePoint ConsultantCommented:

My tried and true Powershell is included below, you need to provide a CSV with the library names and URLs.

This is for on-premises, as RainerJ points out you need special ways of working to run such Powershell against SP Online. Looking at the tool he suggests this Powershell might not need too many modifications.

If the tool doesn't work out, Chris O'Brien points out how to run powershell against SP Online is a slightly different way also using CSOM;

function Create-SPLists {

$libraryobjects = Import-CSV C:\Libs.CSV -Header Name,URL

ForEach ( $libraryobject in $libraryobjects ) {

New-SPList -Web http://MySite/MyWeb -ListTitle $libraryobject.Name -ListUrl $libraryobject.URL -Description "My Library" -Template "Document Library"



function New-SPList {
Start-SPAssignment -Global
$SPWeb = Get-SPWeb -Identity $Web
$listTemplate = $SPWeb.ListTemplates[$Template]
$list = $SPWeb.Lists[$ListUrl]
$list.Title = $ListTitle
$list.EnableVersioning = $true
$list.EnableMinorVersions = $true
 $list.MajorVersionLimit = 2
 $list.MajorWithMinorVersionsLimit = 5
$list.OnQuickLaunch = $true
$list.EmailAlias = "string_value" #should be the email first part only, e.g. "test" in ""
$list.RootFolder.Properties.Add("vti_emailoverwrite", 1) #1 = true, 0 = false
$list.RootFolder.Properties.Add("vti_emailsaveoriginal", 1) #1 = true, 0 = false
$list.RootFolder.Properties.Add("vti_emailattachmentfolders", "root") #valid values are "root", "sender", and "subject"
$list.RootFolder.Properties.Add("vti_emailusesecurity", 0) #1 = true - Use Document Library Permissions, 0 = false - Allow All/Anonymous
Stop-SPAssignment -Global


Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.