SharePoint Filter List / Library by Querystring

If you need to filter a list / library, but don’t want to have to make new View .ASPX files, it’s a simple but effective thing to know that standard Views accepts querystring filter values. So can you put in filter/order/etc. values directly into the URL to accomplish your goal. You could always batch create Views using PowerShell with a technique like the one described here, however if you want to keep things in one simple view then go with the query string approach.

http://go.mysharepoint.com/SiteName/LibraryName/Forms/ChangeLogMergeView.aspx?FilterField1=MyColumn&FilterValue1=Custom Value

You’ll need the following querystring values:

FilterField1 (first filter, column to filter by)
FilterValue1 (first filters, the string you want to filter by)

If you have multiple clauses to filter by, just add another pair of FilterField1 / FilterValue2 pairs, and increment by one, so:

http://go.mysharepoint.com/SiteName/LibraryName/Forms/ChangeLogMergeView.aspx?FilterField1=MyColumn&FilterValue1=Custom Value&FilterField2=MyOtherColumn&FilterValue2=Another Custom Value

The one to watch out for is the FilterField which is looking for the CAML Query-style name of the field. So if you wanted to filter by a field name that has spaces in it, you need to replace the spaces with _x0020_  (which represents a space character). So “Date Modified” becomes:

&FilterField1=Date_x0020_Modified

Incoming search terms:

Tags: , , , ,

Trackback from your site.

Keith Tuomi

Keith is SharePoint Consultant and problem solver with itgroove. He's been focused on Microsoft technologies as a Developer and Web Applications specialist since the beginning of the internet era in the early '90s, with formal training coming from the esteemed British Columbia Institute of Technology. He is a SharePoint MVP, which is a coveted Microsoft award for community contributions and technical excellence. Keith has wide array of international experience and is also adapt at translating your business needs into bits & bytes.

Comments (2)

Leave a comment

Recent Comments

  • ChristopheD

    Hi Keith
    Sorry for the late answer but I had some urgent problems to solve.
    It’s ok now the feature has been removed and there is no more message.
    thanks a lot for your help and time.

  • Keith Tuomi

    Don’t worry, I often am unable to wrap my head around SharePoint too. ;)

    It really does sound like what you need a is Workflow. A workflow let’s you perform business logic like you described – check out the getting started guide at http://msdn.microsoft.com/en-us/library/office/jj163917(v=office.15).aspx. SharePoint includes Workflow out of the box, all you need to do to get started is download a free copy of SharePoint Designer.

Follow me on Twitter