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;



Steps to achieve it


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;



In the REST API URL part provide following URL.


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



<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!