How can we help you today?

How to Connect to a Folder inside a Document Library Using REST API

Connecting a ShortPoint Design Element to a SharePoint Document Library is a simple task. But what if you want to connect the Design Element to a folder inside the Document Library to show the files contained there? Like this one:


Example Folder


To complete the task, we will be using the REST API connection type. Please follow the steps below.


TABLE OF CONTENTS


Step 1. Insert a ShortPoint Design Element


In the edit mode of the page,  press the ShortPoint Insert button on the top to open the Page Builder:


Insert Design Element


For this example, we will be using a Simple List - but as always, feel free to choose any Design Element you want.


Choose the Simple List Design Element from the Page Builder grid:


Select Simple Lists


The settings of the Design Element will open.



Here is the URL we will use:


https://site url/_api/web/GetFolderByServerRelativeUrl('Document Library Name/Target Folder Name')/Files


You will substitute the items highlighted in red with your actual website url, document library name and folder name. 


Here is an example of what the URL could look like:

https://mycompany.sharepoint.com/_api/web/GetFolderByServerRelativeUrl('Shared Documents/Target Folder')/Files


In the above example:

  • mycompany.sharepoint.com is the URL of my site;
  • Document Library with Folders is the name of my Document Library;
  • and Target Folder is the name of the folder inside the Document Library to which I want to connect.


Note: You can select specific fields/columns by adding the ?$select= query string to the end of your REST API URL and including the internal names of the columns.

For custom columns you created, you can use ListItemAllFields/CustomColumnInternalName

Here is an example REST API URL showing some default columns, as well as a custom column called "Description":

https://mycompany.sharepoint.com/_api/web/GetFolderByServerRelativeUrl('Shared Documents/Folder Name')/Files?$select=Name,TimeCreated,TimeLastModified,Title, ListItemAllFields/Description,Author/Title&$expand=Author,ListItemAllFields

Check our our solution article ShortPoint REST API: Selecting, Filtering, Sorting Results in a SharePoint List to learn more.

Step 3. Set up the connection


Switch to the Connect tab of the Design Element settings and select REST API connection option:


Select REST API


Paste the URL you have created in Step 2 into the REST API URL field and press the green Connect button:


Paste REST API URL


Step 4. Map the Items


Switch to Items tab.


Here, by using the chain icon button, select the columns of the list that you would like to display.

For more information please check our article: ShortPoint Connect: Basic Tutorial.

Here is an example of Items Mapping:


Map Items


Note: If you are using an image-based Design Element, you can use the following format in the Image field:

https://mycompany.sharepoint.com/Document Library Name/Folder Name/#name

Please be sure to change the values in red, as before.

Result


Here is what the result will look like:


Result


Related articles:

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