Query String URLs are like, SO Useful! (Part 1 of 4)

In this blog post, I’ll not only explain what Query String URL Filter web parts are, but what the whole concept is behind query strings, and some ways to make use of them in SharePoint.  First of all, what is a query string?  Basically, it’s a part of a URL that contains a filter, to send filter information to the page that you’re viewing.  These are used all over the place on the web, not just in SharePoint.  The basic syntax consists of a question mark followed by a word, and the “equals” something.  So, if you are looking at a web page that consists of information pertaining to the marketing department, your URL could end with this query string:


In SharePoint, if you have MOSS Enterprise, there’s an out-of-box web part called the Query String URL Filter.  But, as I will show you later, you can still do query string filtering if you don’t have MOSS Enterprise.

So begins the love story between me and query strings…

The first time I used them was when I created a policy management system in SharePoint.  Picture this, a library of policies, with a Department column in the library, and each policy was associated with a department name.  To create a list of policies for each department, you could create multiple views on the library, with each view just being filtered by the Department column being equal to ___ (each department name).  Well, I didn’t want to do this, because I didn’t want to have to go back and modify 30 different views if the business owner decided that a column needed to be added or something.  So, instead, I did this:CropperCapture[110]

  1. Go to the default view URL:
    Click Site Actions and Edit Page.
  2. Insert the Query String URL Filter web part on this AllItems.aspx page, above the document library.
  3. Go into the filter web part’s properties, shown in this screenshot.
  4. In the Query String Parameter Name, put a word that describes the field you’ll be filtering by.  The Filter Name can optionally be changed, but it doesn’t really matter.
  5. Click OK in the web part tool pane.
  6. Connect the Query String URL Filter web part to the list or library web part that you’d like to filter.  In this case, it’s a list  of company policies, in which I’m going to create a filter for policies related to each department name.  At the top right corner of the filter web part, click the Edit button and choose Connections –> Send Filter Values To –> and choose the name of the library, in this case it is the Policy List, as shown in this screenshot:connect
  7. On the Configure Connection screen, pick the Consumer field.  The consumer web part is the one you’re sending the filter to.  The Policy List here.  I’m filtering by the Policy Department, so that’s what I pick in the drop-down box.
    Note that whatever field you filter by needs to be displayed as a column in the web part in order for it to be listed in the drop-down box on this screen.  If you’d like to filter by a column and NOT display it in the web part, that consumer web part needs to be a data view web part.
  8. Click Finish and Exit Edit Mode.
  9. Manually create a link to each department’s list of policies.  Put these in a links list or in the Quick Launch or wherever.  Here’s an example of what the filtered list of IT policies looks like:

Notice a couple of things.  See that the Policy Department field shows that little filter icon, and it shows only the IT policies.  Also notice the URL.  It is:


Note: If you insert this web part on your default view, just remember that when new views are created, they will be based on this default view (by default) and they will also include this extra web part, which you may need to remove from new views.

I’ve demonstrated a very basic way that the Query String URL filter can be used.  Once you understand the basic functionality, there are many more things you can do with it.  Part 2 of this 4 part series will cover a more advanced, elaborate solution.

Technorati Tags: ,


  • waldemar.moes@bugaboo.com

    Hi Laura, I was wondering: This al works great, however I cannot get this concept to work when url-filtering a list on a lookup column that is retrieved from an external content type. Do you happen to know if this is simply impossible? Can you only filter on “native” columns and not lookup columns or just not when they are filled using an item picker from an external content type? Or is there a work-around? Much obliged, Waldemar

  • forbesn@chiefind.com

    I have SharePoint 2010 (enterprise). I have set up the Productivity Hub. I have added my own document library for content we have written. I added a Product column to the library and the choices match the produt choices in the Productivity Hub (Excel, Word, etc.) I have added a web part to the products.aspx page that displays the library. I want to filter the contents that displays based upon the Product parameter in the querystring. (/Pages/Product.aspx?Product=Excel) I can’t find the query string url filter listed in any of the web part choices. Is there a way to modify the filter on the view to reference the query string parameter? Other ideas?

  • Waldemar, I believe the external content type column is storing some other value, not just the obvious field’s value that you’d think. Just like with lookup columns, when the value being stored is some long convoluted string. So, if you knew the actual filter value then yes you could probably filter by it. forbesn, This web part is part of the enterprise version of the product, so make sure that you have the enterprise features enabled at the site collection and site level.

  • Hi, I have an issue here, I have a blog in SharePoint 2010.When I’m redirected from a custom web part to /BlogName/Lists/Posts/Newpost.aspx page I should be able to select one(Events) category automatically. For Eg: If I am passing a query string as ../Blogname/Lists/Posts/Newpost.aspx?Status=Events, the Category should be selected as Events in the NewPost.aspx page. Is this Possible. regards, John Jay

  • John, That sounds like a good idea, but I’ve been burned badly any time I’ve messed with newpost or any of the default pages in a sharepoint blog. I don’t know the answer, and I highly recommend trying it on a test server if you are testing it.

  • Hi Laura, Love the tutorials. I am hoping you can help me resolve an issue I am having when I try to configure the connection. I have added the list and the url filter but the consumer field name that I want to link to is not showing in the list. It is a lookup field to another list. I am running sharepoint 2010 enterprise edition. Any suggestions? Thanks. Tina

  • This is all very nice but how do you pass more than 1 parameter using QueryString filter Web Part? Can anyone in the entire SharePoint community answer this simple question. Something that can be done on any other platform with minimum of fuss.

  • Tina, Which step are you on? I can’t think of why a certain field wouldn’t show there. Developer, Just do it as a data view web part instead. Then, you can pass as many parameters as you want.

  • Hi Laura, I have exaclty a page like yours, I am filtering with the field title as all my connected lists with lookup to the main list bt the Title column, so user understands what to connect to. The Problem is when you have many items in some of the lists in the page although you can limit the number of items returned from Sharepoint the user should be able to see all items related to the current project. If you use Paging in the web part you are losing the filter Param as soon as you click the next page. Can you think of a solution for that problem? Best Regards, Yaron

  • Yaron, Sorry, I can’t replicate that behavior. I don’t know why yours is doing that.

  • re step 9, for your 30 departments, do you literally mean create 30 explicit links: http://mySharepoint/Forms/AllItems.aspx?department=onehttp://mySharepoint/Forms/AllItems.aspx?department=thirty That’s not that much better than creating 30 views is it? Or is the point to just understand the url query web part?

  • Ali.King, Yes, you’d create 30 explicit links, and the reason it is useful is that when something needs to change in that view, you only need to change it once, and not 30 times.

  • Hi Laura,
    Nice Article… Thanks for sharing your knowledge….


  • I am working with SharePoint 2010 Sever Standard and the “Filters” including the “Query String URL Filter” are only available with the Enterprise version.

    What web part can I use to accomplish what you have written above? Is there another article you can point me to?

    Thanks Laura!

  • Hi Peg,
    Yep, the third part in this blog series is perfect for you:

  • Hi Laura – do you know of a way (without using Sharepoint Designer) to get the current user, and use that value in a query string filter? I want to filter on a “Person or Group” column (Name).

    Net is I want to have a hyperlink for user’s to click on called “Assigned to me”, and use the current username in the query string to filter the “Assigned to” column.


  • Thanks Laura..Love You

  • Martha,
    Have you tried creating a view in the list called “assigned to me”? In the view settings, add a filter where:
    Assigned to
    is equal to

  • Thanks Laura, love the article and power hour. I wish i found this years ago. I’ve been trying to build your HR on boarding workflow and got up to the dashboard where I need “Connect a Query String (URL) Filter Web Par” I’m sure I’m not the only person out here that does not have the enterprise version of SharePoint. Is there some way to build the dashboard and get similar functionality without that web part?

Leave a Reply