In this post I’m looking at getting all the lists in a SharePoint site using the REST API.

REST API

One of the important way to create integrations with SharePoint is the REST API. Since a few weeks Microsoft Flow can now simply call the REST API. But is it always easy to get to your data? Well if you have been struggling to get the data out of SharePoint then this post might be for you.

In this post I’m going to have a look at retrieving all my lists from a SharePoint site.

First I’m going to do this the easy way. Use a Get List action and an Apply to each which uses a Compose to get the lists data.

Using the REST API in Power Automate to get all lists in a SharePoint site Microsoft Flow, Microsoft Office 365, Microsoft SharePoint getlists

Ok, now I’ve got the Name and the display name of each list and for the use with the other actions list get items from a specific list this would be probably good enough. But what if you want to get more data form your lists and you would also like to see all the hidden lists.

The REST API is the easy answer.

Using the REST API in Power Automate to get all lists in a SharePoint site Microsoft Flow, Microsoft Office 365, Microsoft SharePoint restapi

For people familiar with the REST API this all looks familiar.

But when you try to get to your data you might find that you get these click to download output links.

Using the REST API in Power Automate to get all lists in a SharePoint site Microsoft Flow, Microsoft Office 365, Microsoft SharePoint clicktodownload

This is when you set the Compose to the following expression:

body(‘Send_an_HTTP_request_to_SharePoint’)[‘value’]

When you click on the click to Download links you will see that the data is retrieved but how do you know what you get? Well, body(‘Send_an_HTTP_request_to_SharePoint’)[‘value’] returns an array of lists and if you now push this through an Apply to each

Using the REST API in Power Automate to get all lists in a SharePoint site Microsoft Flow, Microsoft Office 365, Microsoft SharePoint restapiapplytoeach

Then you will find that you get your lists back

Using the REST API in Power Automate to get all lists in a SharePoint site Microsoft Flow, Microsoft Office 365, Microsoft SharePoint restapiapplytoeachoutput

Have you noticed that you don’t just get just the Name of the lists, you get all of the list configuration settings back. Also you’re now getting 58 lists back rather than the 16 lists that the Get Lists action returns.

What if you need more details from your list?

Well there is a _api/web/lists/getbytitle option available within the REST API!

Using the REST API in Power Automate to get all lists in a SharePoint site Microsoft Flow, Microsoft Office 365, Microsoft SharePoint listdetails

When you run this you will find even more details on the lists that you wouldn’t be able to get to using the standard actions.

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as the Head of Power Platform at Vantage 365. You can contact me using contact@sharepains.com

2 thoughts on “Using the REST API in Power Automate to get all lists in a SharePoint site”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue reading