Saturday, September 17, 2011

List filter with URL values SharePoin


Did you know that you easily can filter your Sharepoint list or library with values in your URL? This means that you can create a “view” without really creating a view. To spice up your GUI you can for instance insert some graphical boxes above your document library view that filters with URL values. Last, but not least, you can use this method to filter the content of all web parts on a page, you are not limited to filter a view in a document library (after all, a view is just a web part on a .aspx page). You can filter on a built-in column, or a column you have created yourself.
Example:
Here I have created a couple of links in the Qiuck Launch. The url for the first link could be:
/Forms/AllItems.aspx?FilterField1=_ModerationStatus&FilterValue1=2
I used a built in column (you will have to use the internal column name) in this example, if you use your own column you just use your columns initial name and the plain value. The filter sign next to the column name shows that you have made a regular filtering of the column. Ofcourse you can filter on multiple values and columns, I guess you can figure that out for yourself:)

How do I know that “2″ equals “pending”? Apply the filter manually and check out the URL, you’ll se both the internal column name and the correct value to filter on.
In other words, adding the following code to your URL makes your URL-filtering day in Sharepoint:
?FilterField1=ColumnName&FilterValue1=ValueToFilterOn

No comments: