In this post I’m looking at getting all the lists in a SharePoint site using the 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.
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.
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.
This is when you set the Compose to the following expression:
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
Then you will find that you get your lists back
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!
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.
2 thoughts on “Using the REST API in Power Automate to get all lists in a SharePoint site”
What about creating a folder within a document library ?
REST can do that can it not ?
Yes you can as described here: