2

As part of a very large migration of data from an internal network to SharePoint 2013 (O365), I need to create a very large number of Document Libraries (several thousand).

Each Document Library corresponds to an individual project, and each project has its own six-digit ID number. For simplicity, each Document Library needs to be named according to its ID number (e.g. "123001", "123002", "123003"). Because there are many thousands of projects, and these projects are often rather large, users need to be able to selectively sync only those projects they are currently working on.

The structure needs to look something like this:

example.sharepoint.com/site/projects/123001
example.sharepoint.com/site/projects/123002
example.sharepoint.com/site/projects/123003

It seems that individual Document Libraries for each project are the only way to achieve this currently.

I have tried a number of different scripts using the SharePoint Online Management Shell; I was hoping to do a bulk creation of Document Libraries using a PowerShell cmdlet and CSV with library names and permissions, but it seems that the online management shell does not support the same cmdlets as normal PowerShell.

Does anyone know of any other means by which to create a large number of Document Libraries in SharePoint 2013?

Thanks in advance for any input!

1

You can use Client object model to programmatically create the Document library:

var targetSite = new Uri("https://<site_url>");
 var login = "<user@tenant>.onmicrosoft.com";
 var password = "<password>";
 var securePassword = new SecureString();
 foreach (char c in password)
 {
 securePassword.AppendChar(c);
 }

var onlineCredentials = new SharePointOnlineCredentials(login, securePassword);

using (ClientContext clientCTX = new ClientContext(targetSite))
 {
 clientCTX.Credentials = onlineCredentials;
ListCreationInformation lci = new ListCreationInformation();
     lci.Description = "My own DocLib";
     lci.Title = "Library";
     lci.TemplateType = 101;
     List newLib = clientCTX.Web.Lists.Add(lci);
     clientCTX.Load(newLib);
     clientCTX.ExecuteQuery();
}

You can pass dynamic data to this function and call this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.