SharePoint Create Folder in List or Document Library

In this SharePoint tutorial, we will discuss SharePoint create folder in list or document library. We will see here, how to create a folder in a SharePoint list and also steps to create a folder in SharePoint Online document library.

By default, folder creation is enabled in SharePoint document library whereas in SharePoint list folder creation is disabled. Check below to enable it.

Also, we will discuss SharePoint create folder in site pages and how many folders we can create in a SharePoint document library.

I will also show you how to create a folder in SharePoint library using Rest API.

Why use folders in SharePoint

Let us first understand why to use folders in SharePoint.

Like, in Desktop we create folders to organize files, the same thing with SharePoint, we create folders in SharePoint to organize files in a SharePoint document library.

Example:

Suppose you want to create a document library to store training related documents like SharePoint development training documents, SPFx training documents, Nintex training documents or SharePoint site owner training documents.

If you will put everything in one documents library, then it will not be properly organized. Your users will find it difficult to find documents.

Now, let us see how to organize these documents in SharePoint.

Option-1:

We can create different libraries for each training course. So, in this case, there will be 4 different document libraries.

But it will be difficult to manage 4 different libraries in the SharePoint Online site.

Option-2:

Another way, we can store all the training related documents inside the SharePoint document library by creating different folders in the library.

So the SharePoint document library folder structure will looks like below:

sharepoint create folder
sharepoint create folder in document library

Similarly, if you want to organize information inside a SharePoint list we can easily create various folders in list.

Check out Enterprise Metadata and Keywords for List and Document library in SharePoint Online

SharePoint Create folder in List

By default, folder creation is disabled in a SharePoint list.

New Folder missing in SharePoint list

But we can enable list folder creation from the list settings page.

Open the SharePoint Online list and go to the list settings page.

sharepoint create folder in list

Then click on Advanced settings that is under General Settings.

Then in Folders select Yes for “Make “New Folder” command available?

how to create folder in sharepoint list

Then Save the page.

Now when you open the SharePoint List, you can see the Folder command like below:

sharepoint list create folder
sharepoint create folder in list

This is how we can enable new folder creation in SharePoint Online list.

Anytime you can click on New -> Folder to create SharePoint folder in List.

Can we create folders in all SharePoint Lists

We can use various list templates to create a list in SharePoint. But all the list templates do not support folder creation.

Below are the list templates does not support folder creation.

  • Tasks
  • Calendar
  • Discussion
  • Survey
  • Wiki

Below is a SharePoint task list, you can see in the ribbon, there is no folder creation (Folder) button. Even if you will go to the List advanced settings page, you will not see the option to enable folder creation.

sharepoint list templates not supported folder creation

Create Folder in SharePoint Library

Now, let us see how to create a folder in SharePoint document library.

In modern SharePoint library, click on New -> Folder in the command bar like below:

sharepoint create folder in document library
create folder in sharepoint library

In case you are using the SharePoint classic experience, From the ribbon, click on FILEs tab -> New Folder like below:

create folder in sharepoint online library
sharepoint create folder in document library

This is how can create folders in SharePoint library.

SharePoint folder or Metadata?

This often comes as a questions SharePoint folder or metadata?

Folders are the old way to organize documents. There are a lot of advantages of using Metadata over Folder in the SharePoint Online document library or list.

Folders inside a document library look exactly the same as we create folders in windows.

But there are a lot of disadvantages to creating folders and subfolders to store documents. It is difficult to manage documents when you have lots of nested subfolders. Also, there is a limit on the number of characters supported in a browser URL, that may create a problem when you have a long folder, subfolder, and file names.

Another disadvantage is that you may end up with duplicate documents, because you may never know you have kept the same documents in multiple folders or subfolders. Like in network drive folder structures.

Another major disadvantage of using folders is that, if you move a document from one folder to another folder, the URL of the document will be changed. So if anyone click on the document URL that you have shared previously, they will land with a file not found error.

That’s why SharePoint Metadata concept came.

Metadata is like tagging a document with the keywords according to your business requirement.

By using Metadata in SharePoint, you can easily filter, group, or sort documents by metadata. And there will not be any chance of duplicate content in the SharePoint library.

The document URL will be shorter always, if you are using metadata.

And also, you can change the metadata of a document number of times without affecting the SharePoint document URL.

So the preferences should always be given to use metadata rather folder to organize documents in a document library in SharePoint.

Check out what are document sets in SharePoint and other articles on SharePoint Document Sets Vs Folder.

You can also check how to configure metadata navigation for a document library in SharePoint Online and Create and configure metadata navigation and filtering for list or library in SharePoint Online.

How many folders you can create in a SharePoint document library

Well, how many folders we can create in a SharePoint document library? There is no direct answer to this.

According to Microsoft, you can store 30,000,000 items in a SharePoint list or documents in a SharePoint document library.

The 30 million items or documents include folders also. SharePoint treats folder as an item.

SharePoint create folder in site pages

Like list, in SharePoint site pages do not have the New Folder creation enabled. In the SharePoint site pages library, by default New folder creation is disabled. You can not see the New -> Folder option.

SharePoint create folder in site pages
SharePoint create folder in site pages missing

Like list we can enable it from the Library Advanced Settings page.

Open the SharePoint site pages library from the Site Contents page. Then click on Settings -> Library Settings.

Then click on Advanced Settings and then in Folders section, select Yes, for Make “New Folder” command available? like below:

create folder in site pages in sharepoint

Now, if you open the SharePoint site pages library, you can see the New Folder creation option like below:

create folder in sharepoint site pages
SharePoint create folder in site pages

This is how we can create folder in site pages in SharePoint Online or SharePoint 2013/2016/2019.

SharePoint create folder rest api

We can also easily create a folder in document library using SharePoint Rest API.

You can use the below Rest API code inside a script editor web part to create folder in a document library in SharePoint Online.

Below is the Rest API code to create folder in SharePoint Online document library.

<strong>Folder Name:</strong>
<input type="text" id="txtName" />
<input type="button" id="btnCreate" value="Create Folder" />
<br/>
<div id="divmessage"></div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$(function () {
bindButtonClick();
});
function bindButtonClick() {
$("#btnCreate").on("click", function () {
createFolder();
});
}

function createFolder() {
var folderName = $("#txtName").val();
var siteUrl = _spPageContextInfo.webAbsoluteUrl;
var fullUrl = siteUrl + "/_api/web/folders";
$.ajax({
url: fullUrl,
type: "POST",
data: JSON.stringify({
'__metadata': { 'type': 'SP.Folder' },
'ServerRelativeUrl': 'Best Practices Documents/' + folderName
}),
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: onSuccess,
error: onFail
});
}

function onSuccess() {
$("#divmessage").html("SharePoint Folder Created Successfully !!!");
}

function onFail() {
alert('Error!');
}
</script>

Once you Save the web part page, the form will appear like below:

create folder in document library using rest api
create folder in document library using rest api

Put the folder name and click on the button “Create Folder”, the folder will be created in the document library.

SharePoint create folder rest api
SharePoint create folder rest api

This is how we can create a folder in SharePoint Online document library using Rest API.

Check out:

In this SharePoint tutorial, we learned:

  • Why use folders in SharePoint
  • SharePoint Create folder in List
  • Can we create folders in all SharePoint Lists
  • Create Folder in SharePoint Library
  • SharePoint folder or Metadata?
  • How many folders you can create in a SharePoint document library
  • SharePoint create folder in site pages
  • SharePoint create folder rest api
>