How to filter a SharePoint list or library using URL parameters

In this age of building bots and eliminating needless clicks and such to get employees the info they need faster and more directly, we need all the best practices we can find when creating solutions for users. This post will share a better practice when it comes to getting reliable, fast results from SharePoint lists and libraries that don’t rely on search index configuration or endless view sprawl.

Quick answer

If you’re just here for the quick answer, here it is. For string values, you can simply add this to the end of the list’s URL to filter it as specified.

?FilterField1=[IntFieldName]&FilterValue1=[FilterValue]
  • Spaces in field names and values: If your value includes spaces, replace them with %20.
  • [IntFieldName]: Internal field names (like Client in the example below is actually the original Title column) can be found in List Settings > Column Settings > Select Column > Check URL of column settings page (it contains the internal field name following &Field=).
Click to enlarge

If you want to learn about how this came up in my work and why I chose it as a solution, read on.

Case

Recently, I was involved in troubleshooting a bot that would search a SharePoint list using its built-in search box. However, the bot would be searching for items that were created minutes prior and the search index hadn’t updated yet so no results would be found and the bot would fail to complete.

So I suggested we filter instead of search.

Why filter?

Filtering lists works independently of the search index. Meaning I can create a new item in a SharePoint Server 2019 (or any SharePoint version) list right now and then filter the list and find that new item immediately. But if I search immediately, it won’t be found yet.

Want to argue about continuous crawls as workaround? Send your thoughts to nothanks@natechamberlain.com.

Changes to the process

For this particular bot, we’d be replacing this process:

  1. Navigate to SharePoint list URL
  2. Activate list’s search box
  3. Enter/type search term (unique item identifier guaranteed to return one result)
  4. Hit enter/search

with this one:

  1. Create a variable for the search term
  2. Navigate to SharePoint list URL with added URL parameter including variable from step 1 (taking us directly to the single result we needed)

It not only simplifies the steps involved, but reduces the likelihood that changes to UI elements will break our bot along the way.

Potential use cases

  • Sending workflow emails with direct links to lists and libraries already filtered
  • Reducing the number of views on a list by having users bookmark URLs including the filter parameters the view would have
  • Improving bot reliability by eliminating some UI-dependent steps
  • Eliminating search indexing delays for users or bots searching for new items
  • Setting a hyperlink column on a list automatically to filter the list/library by that item’s vendor/client/topic/etc. for easy comparison/drilldown (see how to set a hyperlink column using Power Automate)

How to do it

First you need to identify the internal field name of your column on which you’ll be filtering. Then we simply add a bit of text to the end of the list’s URL.

  1. Go to Settings > List settings (or List/Library > List/Library Settings in classic views).
  2. Select the column to filter from under Columns.
  3. Check the URL for the text following &Field= for the internal field name. Note this somewhere as we’ll need it soon.
  4. Go back to your default list view ending in .aspx and add the following to the end of the URL, replacing [IntFieldName] with the field name you got in the previous step:
    ?FilterField1=[IntFieldName]
  5. Now add the following to the end as well, replacing [FieldValue] with what you’d like to use to filter the column referenced in steps 3-4.
    ?FilterValue1=[FieldValue]
  6. Your final URL may resemble the following:
    https://YOURORG.sharepoint.com/sites/YOURSITE/Lists/ListName/AllItems.aspx?FilterField1=NotGov&FilterValue1=1

Filtering yes/no or true/false values

If your filter isn’t working for yes/no columns, replace “no” with 0 and “yes” with 1 in your URL.

Multiple field filters

You can filter the list on multiple columns by adding &FilterField2=… in the same format as the first. See below for an example:

?FilterField1=[Field1]&FilterValue1=[Value1]&FilterField2=[Field2]&FilterValue2=[Value2]
Click to enlarge

One Reply to “How to filter a SharePoint list or library using URL parameters”

  1. Is there a way to use this method to look for something other than equals?

    <
    !=
    begins with…
    contains…

Leave a Reply

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