web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Retreving the item cou...
Power Automate
Unanswered

Retreving the item count for all lists in a Sharpoint site

(0) ShareShare
ReportReport
Posted on by 87

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

Categories:
I have the same question (0)
  • Andrew_J Profile Picture
    1,962 Moderator on at

    @AlexLindberg 

     

    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

     

  • Verified answer
    ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @AlexLindberg 

     

    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:

    ManishSolanki_0-1712721045876.png

     

    2. Add "Apply to each" action and pass the output value object from previous action.

    ManishSolanki_1-1712721128851.png

     

    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:

    ManishSolanki_2-1712721254912.png

    /_api/web/lists/getbytitle('@{items('Apply_to_each')?['DisplayName']}')/ItemCount

    Next, add a compose action to collect the name count in an object array:

    ManishSolanki_3-1712721341496.png

    {
    "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:

    ManishSolanki_4-1712721410196.png

     

    Output:

    ManishSolanki_5-1712721516352.png

     

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

     

     

     

     

  • AlexLindberg Profile Picture
    87 on at

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard