Built-in URL Filtering
SharePoint’s list view
controls (XsltListViewWebPart, ListViewWebPart, etc) recognize a number of
parameters from the query string that can be used to filter and sort
automatically a list view, without requiring any additional effort.
Filter by single value:
FilterField must be an internal field’s name and FilterValue is
case insensitive.
Filter by single value
and an operator:
The list of possible
operators (FilterOp) is:
- Eq: equal
(default);
- Neq: not
equal;
- Gt:
greater than;
- Lt: less
than;
- Geq:
greater or equal to;
- Leq: less
or equal to;
- BeginsWith:
the start of a string;
- Contains:
part of a string.
You can add up to 10 FilterField/FilterValue/FilterOp entries,
the items must match all conditions (AND operator). If you wish to
filter on an additional field of a lookup field, use this syntax:
Filter by one of
multiple exact values:
FilterName is also the internal name of the field and
the values in FilterMultiValue are treated as
case-insensitive. Separate then by ;.
Filter by one of
multiple partial values:
The * character
acts as a wildcard, matching anything before or after. Placing a term between * is
the same as using FilterField/FilterValue with the Contains operator
in FilterOp.
Filter by a taxonomy
field:
If you want to filter by
a managed metadata field, you can either
search by the display name using FilterField and FilterValue,
or you can use the ids of the terms. A little known fact is that all usages of
managed metadata values – values of fields of managed metadata type – are
stored in the TaxonomyHiddenList hidden list. If you want to filter by an id of
a term, you need to use the following syntax (search by one of two values with
FilterOp=In, values separated by commas):
Or by a single value (no
need for FilterOp):
The FilterLookupId=1 is
only there to tell SharePoint that it needs to search not by value (FilterValue)
passed in the query string, but by term pointed by it. You can find the ids for FilterValue in
the TaxonomyHiddenList list.
Sorting:
Possible values for SortDir are
pretty obvious:
- Asc: ascending
(default);
- Desc:
descending.
You can only sort by a
single field.