Tuesday, January 26, 2010

Sharepoint Filter List from url

Sometime you need to a have a link to filtered list in Sharepoint. Luckily Sharepoint has the ability to do this. You need to use the following parameters after the list url:

......allitems.aspx?Filtername=<name of field>&FilterMultiValue=<filter text>


<name of the field> is the field name in your list, you wish to filter on (eg. Name etc)
<filter text> is the filter criteria. You can use * as an wildcard. You can add multiple filter text values by separating them with semi colons.

For example:


......allitems.aspx?Filtername=Name&FilterMultiValue=A*;B*

will show all items starting where the Name starts with A or B.

I like this method because it allows you to have multiple values and wildcards. You could also use the FilterField1 and FilterValue1 parameters. (see for more info: Using URL to sort or filter a list).

6 comments:

Anonymous said...

This is exactly what I have been looking for the last several days. When I try to put this in the url I get a message in the list. My url string was .../AllItems.aspx?Filtername=LinkTitle&FilterMultiValue=A*;B*

Any ideas?

Oguz Karadeniz said...

Make sure that your field name is correct. It could be that the field you are using LinkTitle is actually called LinkTitle. If for example you set the field in your list up as "Link Title" then the actual fieldname could be different as spaces are treated differently, eg it could be Link%20Title

Bgrishinko said...

The semi-colon provides good OR functionality, but is there any way to have AND functionality through the query string?

For example, AllItems.aspx?Filtername=LinkTitle&FilterMultiValue=*A*;*B*

this finds all entries that contain an A or B. I want it to contain BOTH A and B, but not necessarily next to each other.

Oguz Karadeniz said...

If you want to use the "AND" functionality use + instead of ;

eg,
AllPosts.aspx?FilterName=Title&FilterMultiValue=News*+Update*

This will find all items containing News AND Update

Anonymous said...

hi,
can we use this FilterName for multi columns (like FilterField1..2...3 here we can pass more then 1 column)

if we can use for more then one column pls let me know how?

Oguz Karadeniz said...

Using more columns like FilterField is not possible as far as I am aware.