Hi,
I have a SP list with close to 5000 items. I just want to have a quick count of how many items there are actually in this list.
I can get the number of items with Flow through GetItems, but that is really slow, it is taking around 2 minutes.
Is there any other solution which would be much faster?
Thanks,
Bart
Solved! Go to Solution.
Hi @xecho,
The list should have a property called ItemCount. You can retrieve that via REST API. Just tested it, should take less than 1 second 😁
1. Setup of the flow
_api/web/lists/getbytitle('@{variables('ListName')}')/ItemCount
2. Test run with a list with 14000+ items
Hi @xecho,
The list should have a property called ItemCount. You can retrieve that via REST API. Just tested it, should take less than 1 second 😁
1. Setup of the flow
_api/web/lists/getbytitle('@{variables('ListName')}')/ItemCount
2. Test run with a list with 14000+ items
That worked great.
thanks!
and how would you filter this list before counting?
Not sure what you mean, it is an item count, a number, so nothing to sort :-).
The list in Powerapps can be sorted in Powerapps by Sort(listname, variable_for_sorting, Ascending/Descending);
for example I want to get all the items in that sharepoint list that have the assign column as true (using a flow)
Hi @Robert94,
That ItemCount is just a property in the list settings which retrieves and tracks all items in the list. As far as I am aware you cannot combine it with a $filter query parameter and the list items method.
But I might be wrong, let me have a quick look in my development tenant 😁
Hi @Robert94,
It still looks like combining those two is not possible.
However, in your setup you might be able to just first filter and count the number of items afterwards with a length function. For the OP that was not an option, but that might be an option for you 😁
Below is an example.
This is the URI I used, which checks if Assigns is equal to true (1) with a $filter query parameter
_api/web/lists/getbytitle('@{variables('ListName')}')/Items?$select=Title,Id,Assign&$filter=Assign eq 1
This is the expression to count the number of items from the result.
length(body('Send_an_HTTP_request_to_SharePoint')?['value'])
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.