In this post we look at a behaviour of document libraries in SharePoint that shows items as loading, and how to fix it.
The problem
I recently came across something I hadn’t seen before in SharePoint Online when working with document libraries. I was in a library that had more than 30 folders within it, and after the 30th folder the library just displays a sort of pulsing, loading screen similar to the below:
The thing is that nothing actually loads, there is no pagination or way to move to to see any more results, any additional files/ folders or basically any way to navigate further. I decided to dig into this to understand what was causing it and what can be done to resolve.
The solution
I found that the issue related to a view setting within the document library. The default view had an item limit set to “limit the total number of items returned to the specified amount”. Changing this effectively solved the problem, as once changed items are displayed in groups of 30, but a “show all” button will appear that allows you to see all the files/ folders. Here’s how to get to the item limit setting and update it:
Open the affecting document library > press the cog > library settings > more library settings.
Scroll down to views > select the default view.
Scroll down and expand item limit.
Change the radio button setting to display items in batches of the specified size.
Press OK.
Things to note
The number of items to display doesn’t have any bearing on modern views. In the screenshot above I’d changed mine to 100 items to display, but after the first 30 files/ folders, the show all button appears.
The show all button is problematic as if you are grouping within your view, when pressed it will apply an empty filter automatically – showing no files and ultimately confusing people. I’ve wrote about this in detail here.
This post details an issue with document libraries in SharePoint Online when there are more than 30 folders within a ‘grouped’ view, causing files not to be visible to users.
Intro
I’ve been working through a large-scale migration project for some time now, and have recently moved several document libraries from SharePoint 2010 into SharePoint Online. Although the library in question is large (approx. 200K items), it is well structured employing two levels of folder then using metadata to arrange files within.
The problem I’ve observed does not just apply to large libraries, it applies to all libraries that contain more than 30 folders.
The problem
Since migrating the document library I’ve noticed an issue with using group by views. A grouped by view is purely just a view that is grouped by a particular column, by clicking on the column name and pressing “group by”.
Group by selected within a document library view in SharePoint Online.
The library has a default view that has group by enabled to group items by a custom “document type” column. With grouped by views, a limit is automatically applied to the number of folders shown (30) and a “show all” link appears at the bottom of the view. When you click on this, it shows all the subfolders, but also automatically applies a filter to the view to the effect of “document type = empty”. This causes all the files within the subfolders to not display.
Clicking on “show all” applies an empty filter based on the group by column, causing all files within the document library to not display.
This issue only occurs for custom columns, any in-built columns (name, created by etc.) will let you group by and not apply the empty filter.
Response from Microsoft
I raised this issue with Microsoft via support and the response I received was:
“Although it is not desirable behaviour, it is expected”.
Microsoft support response to my issue
It was explained to me that the way these large libraries are structured, which, in my opinion has been considered to be best practice for well over a decade is no longer support in SharePoint Online. In essence this advice was don’t use grouped by views for document libraries with more than 30 folders.
We then proceeded to talk through how to re-build the affected document libraries using a different structural approach to overcome this issue which I will talk through below.
Temporary solutions/ workarounds
#1 Rebuild all affected document libraries
In my example, the document library is for storing employee files, so the first solution to this would be to completely re-build the document library, starting with splitting the library up into smaller, individual libraries (A-Z). Then, instead of interacting directly with the libraries, instead use a combination of pages, the highlighted content and document library web parts, with KQL queries to present the relevant files in a sort of address book style.
For example: there would be an address book page with highlighted content web parts displayed for each A – Z folder. Each highlighted content web part would have a KQL query to only shows the site pages for each employee with the relevant A-Z letter in the title. If this is something you’d like me to do a separate demo on, let me know in the comments section.
An address book page with a highlighted content web part for each A-Z folder, with a query that filters each HCWP to only show the relevant employee pages.
Alongside splitting up the large library into smaller libraries, for this solution you would also have to create a page per employee and add a document library to the employee page, pointing to the relevant library/ folder
#2 Use multiple views to navigate folders/ files
For this workaround I created two views: All Documents and All Folders. The All Folders view does not have grouped by enabled and allows you to navigate through all the folders without running into the empty filter. Once a users arrives at the relevant folder, they switch to the All Documents view which has the grouped by view enabled, allowing the user to view the files within the folder grouped by the custom column.
Two views to switch between All Files and All Documents to allow users to navigate the folder structure and see files grouped by custom columns.
#3 Manually remove the filter
This workaround is by far the simplest option, but puts the most burden on the end user. With this issue, it is possible to just remove the filter after it gets applied by pressing “show all”. Users are able to just untick the filter and continue to use the document library. This is what my users are currently doing.
Manually removing the empty filter allows all files to be displayed within the grouped by view.
#4 Classic view
My least favourite option of them all, but worth including as it does get around the issue. Classic view does not apply the “show all” link or restrict the number of folders displayed within a document library view. Switching to classic view will allow users to interact with the library without issue, but would potentially have other issues if any modern features are being used elsewhere within the library.
Classic view will show all folders without applying the “show all” restriction.