Folder sorting in views

an assortment of folders

A client has alerted me to an unexpected behavior of list views where folders are involved.

The client wanted to make sure the folders are always on the top of the view, regardless of sort order, and, looking at the settings of the view it should have happened. However, seemingly at random some document libraries stopped doing that, while other libraries were fine.
After digging into it a bit, I realised what the issue is: enabling and disabling folders.

You see, the client had custom folder content types added to some of the document libraries, and in those libraries the client wanted to make sure the users don't create folders of the built-in content type using the "New Folder" button in the ribbon. To achieve this, they changed the setting in document library advanced settings to not "Make "New Folder" command available?".

Turns out that when this setting is set to "no", there are other ramifications than just not showing the new folder command. It also tells views to behave as it there are no folders - and treat all folders items. Result - in those libraries folders were sorted with items, and were not at the top of the views. Makes sense if you consider that that setting is mapped to the SPList.

EnableFolderCreation

in code - meaning it tells the list that folders are not available - even though you can still create folder using the "new" button and choose a content type that inherits from folder.
To resolve this, we made sure the "Make "New Folder" command available?" option is always set to "yes", but we activated a feature that disabled the new folder button itself - not touching the document library setting.

Certifications

microsoft sharepoint server 2010 certified master
microsoft sharepoint 2016 certified professional badge
microsoft certified expert badge

Subscribe for Sharepoint Tips & Tricks

Exclusive offers in your inbox

© Copyright 2023 Sharepoint Tips