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.
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.
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”.
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.
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.
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.
#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.
#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.