How can we help you today?

How to Show Both Files and Folders of the Document Library in your ShortPoint Element

You have a ShortPoint element on the page and you would want to connect it with your document library and show both files and folders in flat structure:



Step 1: Add File Lists ShortPoint to the page


Add any element to the page In this example, I am going to add File Lists ShortPoint but this solution is not restricted to it.



Go to Connect and Select Rest API connection type;



Step 2: Query for files and folder mixed and sorted in single list


to have the list of files sorted by name in ascending order


<Your Site Url>/_api/Web/Lists/GetByTitle('<Library Title>')/Items?$select=FileLeafRef,EncodedAbsUrl,Modified,Created,Editor/Title&$expand=Editor&$orderby=FileLeafRef%20asc


to have the list of files sorted by name in descending order


<Your Site Url>/_api/Web/Lists/GetByTitle('<Library Title>')/Items?$select=FileLeafRef,EncodedAbsUrl,Modified,Created,Editor/Title&$expand=Editor&$orderby=FileLeafRef%20desc


If you want to limit the number of items, please append $top=<number of items you want to show> in the query. For example:


<Your Site Url>/_api/Web/Lists/GetByTitle('<Library Title>')/Items?$select=FileLeafRef,EncodedAbsUrl,Modified,Created,Editor/Title&$expand=Editor&$orderby=Modified%20desc&$top=5


Above REST URL will show the most recent 5 items in your document library.


<Your Site Url>: This should be URL to your web (for example https://shortpoint.sharepoint.com/sites/demo)

<Library Title>: This should be the title (Name) of your document library


Example URL looks like;

/_api/Web/Lists/GetByTitle('Documents')/Items?$select=FileLeafRef,EncodedAbsUrl,Modified,Created,Editor/Title&$expand=Editor&$orderby=FileLeafRef%20asc



Query for returning all folders sorted followed by all files sorted


to have the list of files sorted by name in ascending order


<Your Site Url>/_api/Web/Lists/GetByTitle('<Library Title>')/Items?$select=FileLeafRef,EncodedAbsUrl,Modified,Created,Editor/Title&$expand=Editor&$orderby=FSObjType%20desc,FileLeafRef%20asc


to have the list of files sorted by name in descending order


<Your Site Url>/_api/Web/Lists/GetByTitle('<Library Title>')/Items?$select=FileLeafRef,EncodedAbsUrl,Modified,Created,Editor/Title&$expand=Editor&$orderby=FSObjType%20desc,FileLeafRef%20desc



<Your Site Url>: This should be URL to your web (for example https://shortpoint.sharepoint.com/sites/demo)

<Library Title>: This should be the title (Name) of your document library


Example URL looks like;

/_api/Web/Lists/GetByTitle('Documents')/Items?$select=FileLeafRef,EncodedAbsUrl,Modified,Created,Editor/Title&$expand=Editor&$orderby=FSObjType%20desc,FileLeafRef%20asc




Now we need to merge both Files and Folders JSON objects retrieved from above REST query. To do that, check Enable Advanced Settings and provide following javascript code in Map Results;


return data.d.results;




Click Connect. 


Here are the sample mappings in Item tab, however you can do mappings the way you want;



That's It! Happy connecting!

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

World's best intranet sites are designed using ShortPoint

Get started today! Learn more
See all 27 topics

Start a trial

Ignite your vision. Install ShortPoint directly on your site, or play in sandbox mode. No credit card required.

Get started today

World’s best intranet sites are designed using ShortPoint

Thousands of companies using ShortPoint everyday to design, brand and build award winning intranet sites.

Get started Learn more