Use Microsoft Flow to get the number of items in a SharePoint list or library

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.

  1. Use Microsoft Flow to get the number of items and use in various ways
  2. Add “count” to the top of a classic view SharePoint list for all to see
  3. 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
  1. 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.
    chrome_2018-08-21_08-10-25
  2. Add a new action: “Get items”.
    chrome_2018-08-21_08-13-48
  3. Enter your site and list name
    chrome_2018-08-21_08-10-34
  4. Go to the settings for the “Get items” step (click the “…” and “Settings”)
    chrome_2018-08-21_08-11-24
  5. 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.
    chrome_2018-08-21_08-11-09
  6. Add new step –> Action: “Compose”
  7. Insert the following into the step:
    "@length(body('Get_items')?['value'])"

    chrome_2018-08-21_08-11-37

  8. 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 (“_”).
  9. Add your final action (update list item, add item to list, email someone, calculate, etc.) I’m going to email someone the list count.
    2018-08-21_08-12-22
  10. Save and test your flow!
    email

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.

  1. Modify the list or library view for which you want to display a count of items
    iexplore_2018-08-21_07-50-36
  2. Scroll down and expand “Total”
  3. Choose the field you wish to display count above and change “None” to “Count”
    2018-08-21_07-52-00
  4. 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.
    Count View

Just view the number of items in a list or library:

  1. Go to Site Contents
    site contents
  2. Look beneath the name of the list you’re interested in for the number of items it contains
    site contents item count

If nearing the item threshold on a list, you can also view that by:

  1. Going to list settings
    list settings
    OR
    list settings o365
  2. View “threshold” bar
    list view threshold

If you’re near your limit, here’s how to surpass the threshold without breaking your views.

 

 

Advertisements

Written by SharePoint Librarian

I'm a SharePoint Business Analyst and Jayhawk from the Kansas City Area.

One comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.