Sometimes you need the number of items in a list or library for reporting, notifications, or just curiosity. The following details three methods you can use to get the count of items for different purposes.
- Use Microsoft Flow to get the number of items and use in various ways
- Add “count” to the top of a classic view SharePoint list for all to see
- Quickly find “count” just for your information in site contents or list settings
(Video at bottom of first section)
By using Microsoft Flow, you could:
- Email someone with the count
- Update another list or item with the total item count
- Trigger a conditional step (such as “If my list has more than 4,000 items, send threshold warning to Nate”)
- Use the count in a calculation or variable
- Create a new flow in Microsoft Flow, with whatever trigger you’d like. I’m using the “Manually trigger a flow” trigger. The “recurrence” trigger might be handy too, if you’d like to have it produce the number of items on a regular basis.
- Add a new action: “Get items”.
- Enter your site and list name
- Go to the settings for the “Get items” step (click the “…” and “Settings”)
- Turn on pagination and set a higher item limit or it will only return the number of items visible in your default view’s batch size (typically 30). Save.
- Add new step –> Action: “Compose”
- Insert the following into the step:
"@length(body('Get_items')?['value'])"
- Replace the red text with the name of your previous step if it’s different from Get items. Any spaces should be replaced with an underscore (“_”).
- Add your final action (update list item, add item to list, email someone, calculate, etc.) I’m going to email someone the list count.
- Save and test your flow!
Here are some additional ways to get the number of items from lists without using Microsoft Flow:
Add a “Count” field to the top of your classic SharePoint lists or libraries.
- Modify the list or library view for which you want to display a count of items
- Scroll down and expand “Total”
- Choose the field you wish to display count above and change “None” to “Count”
- Click OK. If you also “group” your items in a view, you’ll now have a total count as well as a count for each group in your list. Though by grouping, you automatically get that group’s count in parentheses after the group name as seen below as well.
Just view the number of items in a list or library:
- Go to Site Contents
- Look beneath the name of the list you’re interested in for the number of items it contains
If nearing the item threshold on a list, you can also view that by:
- Going to list settings
OR
- View “threshold” bar
If you’re near your limit, here’s how to surpass the threshold without breaking your views.
Thanks for this. Just wondering if there is a way to get the number of items in a particular view rather than the whole list.
Hi, Can this be used to create a unique item ID in a sharepoint list? I have a flow setup to capture responses from a survey created in Forms, but I want to create ID’s to track the submissions. My thought is that I could use your steps to get a count of the items in the list to create a unique ID (with a prefix like BI-19) for each item. Does that sound like it would work?
Thanks!
Terry
Hi this is cool, what if you have a list or library with greater than 5000, will is do the count in batches or does it only allow 5000