A simple request - How can I retrieve the item count of all lists in a specific SharePoint site?
I know the following uri will get the item count for a specific list when using the SharePoint's HTTP widget
/_api/web/lists/getbytitle('ListName')/ItemCount
The must be a way to do this for all lists in the site. Much like the "Site Contents" function in a view.
Also, where are all REST API functions documented for SharePoint?
Thanks as always for your time.
Alex
Thank you for your solution. I was trying to avoid loops and do-until constructs.
The HTTP REST APIs for getting information from SharePoint exist, but I can't find a simple API that will provide the same information that the "Site contents" URL gives. That is all I want. The URL lined is;
https://myCompany.sharepoint.com/sites/MySharePointSite/MySharepointCollection/_layouts/15/viewlsts.aspx
The URI fragment _layouts/15/viewlists.aspx has the answer..... The answer could be a loop as you suggested.
Here is the sample flow that generates csv table for all list and libraries in a site.
1. Add "Get all lists and libraries" action to get all list and library of a site:
2. Add "Apply to each" action and pass the output value object from previous action.
Inside apply to each block, add "Send an HTTP request to SharePoint" action that uses rest api to get the count of a list or library:
/_api/web/lists/getbytitle('@{items('Apply_to_each')?['DisplayName']}')/ItemCount
Next, add a compose action to collect the name count in an object array:
{
"Name": @{items('Apply_to_each')?['DisplayName']},
"ItemCount":@{body('Send_an_HTTP_request_to_SharePoint')?['d']?['ItemCount']}
}
3. Finally, create a csv table from the output of compose action using "Create CSV table" action:
Output:
If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.
I cannot answer the question on the ALL LISTS but my refrenace for the Rest API is as follows:
https://www.expiscornovus.com/tag/sharepoint-online/
@Expiscornovusinformation has given me the confidence to use them and I have a flow that is working a treat now. This flow sends out a task list and then through a sperate flow goes in an updates the dates to the following year. So now I do not have to touch anything.
Also Audrie Gordon has a usefull video on list production using the HTTP.
https://www.youtube.com/watch?v=a9cwdaXd7ec
Regards,
Andrew
stampcoin
73
Michael E. Gernaey
66
Super User 2025 Season 1
David_MA
48
Super User 2025 Season 1