Passing Filter Parameters Through SharePoint URLs

Here’s a neat trick I figured out the other day.  It didn’t actually solve my problem, but I figured it was worth documenting in case it comes in handy in the future.  My goal was to add filter parameters to a URL so that it would automatically filter for specific elements.

This sort of technique could be used to point users or a page viewer webpart from a project workspace back to a centralized document repository, the likes of which I described in this post.

So first off, we need the URL of the list.  Since I have the Contoso demo environment open, I’ll just use the sample report library in the BI Center.

http://project.contoso.com/PWA/ProjectBICenter/Sample%20Reports/Forms/AllItems.aspx

image

Now let’s filter on all items where Modified By = Marc Soester.  We need to identify how the system is referring to the Modified By field.  To do this, click on the Library tab, and select the Library Settings option.  Click on the Modified By field in the middle of the page.

That will yield a page that looks like this:

image

Take a look at the URL:

http://project.contoso.com/PWA/ProjectBICenter/_layouts/FldEditEx.aspx?List=%7B0AE8F9C9%2D0277%2D40DE%2DAFAB%2D25B10127CC3A%7D&Field=Editor

That last bit is what we’re looking for.  Internally, SharePoint refers to the Modified By field as the Editor field.

So now we take the original URL and add the following string:

?&FilterField1=Editor&FilterValue1=Marc%20Soester …to yield the following URL:

http://project.contoso.com/PWA/ProjectBICenter/Sample%20Reports/Forms/AllItems.aspx?&FilterField1=Editor&FilterValue1=Marc%20Soester  

Click on that, and you get a filtered list:

image

Want to filter on two fields?  Use the following syntax:

http://project.contoso.com/PWA/ProjectBICenter/Sample%20Reports/Forms/AllItems.aspx?&FilterField1=Editor&FilterValue1=System%20Account&FilterField2=DocIcon&FilterValue2=vdw

…which will filter on all Visio Drawings (VDW) created by the System Account.

image

About these ads

About Andrew Lavinsky

I am a consultant with the UMT Consulting Group, one of the premiere project portfolio management consulting companies in the world, galaxy, or universe for all I know.
This entry was posted in SharePoint and tagged , . Bookmark the permalink.

2 Responses to Passing Filter Parameters Through SharePoint URLs

  1. Bob says:

    Thank you
    Exactly what I was looking for.
    Now do you know of a good way to automate the building of that url so we don’t have to do the copy/paste thing?

  2. Mohan says:

    Thank you. Your post helped me as a workaround.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s