SOLVED

How to sort Highlighted Content by Date Created

Iron Contributor

I'm using Highlighted Content to provide a list of documents in a directory using Filter to show items that have Active in the Status column. This way, regardless of the number of nested folders an item may be in, anything with Active in Status will appear in this Highlighted Content web part (a VERY useful feature!!).   

 

Currently, it's sorted by Most Recent but I want to sort by Date Created. As we acquire new documents, they should appear at the top of the list (provided Active is set in Status). The issue with sorting by Most Recent is that this is putting the most recent MODIFIED documents at the top of Highlighted Content.  

 

Is there a way to build a Custom Query to sort by Date Created? 

 

Screenshot 2023-01-20 at 3.06.19 PM.png

5 Replies

Hi @Anthony-123 ,


If you use the source "This site collection" or "This site" or "All Sites" or "Select Sites", then try to sort your data by the managed property "Created" descending

mmpptcreated.png

If you select the source "A document library on this site", then sorting by the "Created" date does not seem to work with the "Highlighted Content Webpart". 

But in that case you can simply use the "Document Library webpart".

 

  1. Go to your document library and create a new view that is filtered to your active column and sorted by the "Created" Date descending.
  2. Switch that view to "Tile" mode and save it as "New Documents" or something like that.
  3. Then go back to your page with the "Highlighted Content Webpart" and remove that webpart from your page.
  4. Insert the "Document Library Webpart" and select your document library and your new view.
  5. Deselect "Show command bar" and "Show See all button"

 

If you don't like the "Tile" view, you can customize it.
This would too much for this post, but take a look at i.e. this sample https://github.com/pnp/List-Formatting/tree/master/view-samples/document-library-gallery-card 

Best Regards,

Sven

Neither of these solutions work for me.

The issue is that I only want to show a list of documents in a specific document library. Setting the Source as "A Document Library On This Site" does not present the option to Sort by Created. Yes, if I change the source I can see this option to sort but then I'm seeing documents from the entire site, not the specific document library. Seems like a bug to me. Technically, I could probably add a column to this library to use the filter function but I'm not going to do that extra work to fix a Microsoft bug.

Going to my document library and creating a new view that sorts by active column results in zero items. This is why I'm using the Highlighted Content web part. If the document library view were able to show all documents regardless of number of nested folders, this would be ideal.

The objective is to show all the documents in a document library in descending order by date created regardless of how many folder / levels deep the document may exist.
best response confirmed by Anthony-123 (Iron Contributor)
Solution

Hi @Anthony-123 

 

"Going to my document library and creating a new view that sorts by active column results in zero items. This is why I'm using the Highlighted Content web part. If the document library view were able to show all documents regardless of number of nested folders, this would be ideal."

If you want to display all files in a view of a documentlibrary regardless of folders, you need to edit the View


EditView.png

And scroll down to and expand "Folders" and check "Show all items without folders"

Folders.png
This results in a view that displays all files in the document library regardless of folders. 
You can still sort and filter that view to your liking.

Best Regards,
Sven

That'll do it! I didn't know about that Folder option in the view. Thanks so much!
1 best response

Accepted Solutions
best response confirmed by Anthony-123 (Iron Contributor)
Solution

Hi @Anthony-123 

 

"Going to my document library and creating a new view that sorts by active column results in zero items. This is why I'm using the Highlighted Content web part. If the document library view were able to show all documents regardless of number of nested folders, this would be ideal."

If you want to display all files in a view of a documentlibrary regardless of folders, you need to edit the View


EditView.png

And scroll down to and expand "Folders" and check "Show all items without folders"

Folders.png
This results in a view that displays all files in the document library regardless of folders. 
You can still sort and filter that view to your liking.

Best Regards,
Sven

View solution in original post