Skip to main content

How to list folders first in a Documents list [Resolved]

Yes, OK folders=bad. With that out of the way, what's the best way to have folders appear first in a Documents library then have the documents sorted alphabetically? Right now I'm sorting on Title which is blank or null for folders, then Name linked to document with edit menu. Any better way? This seems to work so far but I'm concerned that relying on a blank meta-data field might not be the best course of action.

Question Credit: TadLewis
Question Reference
Asked July 11, 2019
Posted Under: Sharepoint
3 Answers

Done a lot of searching and this is the best solution I've come up with so far to mimic file explorer behavior. Sorting on the Title metadata field which is blank or null for folders, then the Name (linked to document with edit menu) metadata field gives you Folders sorted to the top of the listing alphabetically, then Files sorted alphabetically BUT if you have users that put information into the Title field of the documents, then you're back to square one. One other option is to sort by Type first then Name.

credit: TadLewis
Answered July 11, 2019

Option 1:

I agree with - Damjan Tomic

Option 2:

Another option I found was provided by LauraRogers MVP on MSDN Social entitled: Custom Ordering in Document Library

create a custom "folder" content type:

  1. Site Settings - site content types
  2. Click Create
  3. Call it "New folder" or whatever you want. parent content type = "folder content type" and then "folder".
  4. Create a new site column to be associated with this new content type. Call it "folder order" or something, and make it a number column.
  5. on your library, go to library settings and advanced settings. Change "allow mgmt of content types" to YES
  6. In the library's settings "content types" section, click to add an existing content type, and pick that new one called "new folder" at step 3
  7. In the library's advanced settings, change "Display "New Folder" command on the New menu" to NO.

Now in the "new" drop-down box there's the ability to create a new folder, and that new folder has a "sort order" column. Then you just have to sort your list by that column (MSDN Social).

credit: blayderunner123
Answered July 11, 2019

Sort on Item Child Count (descending) instead of Folder Child Count. This will put folders at the top.

credit: Jonathan Dunne
Answered July 11, 2019
Your Answer