How can we help you today?

How to Show Only Folders of your Document Library in a ShortPoint Element

If you have a ShortPoint element on the page and you would like to connect it with your document library and show only folders (all hierarchy into flat structure), this article is for you. For example, we have 4 folders in our Documents Library, like this:



You can connect your ShortPoint element to show only the folders of this library. This is how it will look like, for example, in the File Lists Design Element:



To complete this task we are going to use the REST API connection type. Please, follow the steps below.


Step 1: Add a ShortPoint Design Element to the page


Add any ShortPoint Design Element to the page. We recommend using the lists elements to display the documents and folders. For the purpose of this article, we will add the File Lists Design Element.

  • Modern experience:

In the edit mode of the page, click Edit the web part button: 



Click the big blue plus icon to insert the ShortPoint and open the Page Builder:



  • Classic experience:

In the edit mode of the page, choose Insert from the ribbon and press the ShortPoint Insert button to open the Page Builder:



Then, choose the File Lists element from the Page Builder grid:



The settings of the element will open.



Step 2: Prepare your REST API link


Option 1: You are using the root site collection and the root site document library


Here is the URL we will use:


https://tenant url/_api/web/GetFolderByServerRelativeUrl('/Library Name')/Folders?$filter=not substringof('/Forms', ServerRelativeUrl)


Note: Adding ?$filter=not substringof('/Forms', ServerRelativeUrl) to our URL will result in showing only the visible folders from your document library. Without it, the element will show an extra folder, called Forms - it is hidden folder which exist on root of every library.

Here, you will need to substitute the item highlighted with red, with your actual website URL (tenant URL), and the item highlighted in green, with your document library name. 


For example, here is how our URL looks like:


https://mycompany.sharepoint.com/_api/web/GetFolderByServerRelativeUrl('/Document Library with Folders')/Folders?$filter=not substringof('/Forms', ServerRelativeUrl)


where:

  • mycompany.sharepoint.com is the URL of our tenant (root site);
  • Document Library with Folders is the name of our Document Library.

Option 2: You are using a different site collection and its document library


You can as well connect to the subsite, other site collection, subsite under other site document library.

Here is the URL we will use:


https://tenant url/sites/site collection name/_api/web/GetFolderByServerRelativeUrl('/sites/site collection name/Library Name')/Folders?$filter=not substringof('/Forms', ServerRelativeUrl)

Here, you will need to substitute the item highlighted with red, with your tenant URL, the item highlighted in yellow, with the way to your site, and the item highlighted in green, with your document library name. 


For example, here is how our URL looks like:


https://mycompany.sharepoint.com/sites/marketing/_api/web/GetFolderByServerRelativeUrl('/sites/marketing/Document Library with Folders')/Folders?$filter=not substringof('/Forms', ServerRelativeUrl)


where:

  • mycompany.sharepoint.com is the URL of our tenant (root site);
  • sites/marketing is the way to our site collection;
  • Document Library with Folders is the name of our Document Library.


Note: if you are connecting to a subsite your URL will not have the /sites/ path right before it:

For a root subsite your URL will be look similar to this:
https://tenant url/subsite/_api/web/GetFolderByServerRelativeUrl('/subsite/Library Name')/Folders?$filter=not substringof('/Forms', ServerRelativeUrl)

For a subsite under other site collection your URL will be look similar to this:
https://tenant url/sites/site name/subsite/_api/web/GetFolderByServerRelativeUrl('/sites/site name/subsite/Library Name')/Folders?$filter=not substringof('/Forms', ServerRelativeUrl)

Step 3: Connect your ShortPoint Design Element to the folders


Switch to the Connect tab of the element's settings and choose REST API from the connection types:



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



Step 4: Map the Items and save your page


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 our example of the Items Mapping:



After the Items are mapped, click Update and save your page.




Result


Ready! Here is what the result will look like:



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