SharePoint and the magic of query strings
One of typical requests from users is the ability to have a page open in a certain state, where things automagically appear and happen by themselves.
Throughout my travels, I have come by many of these magic strings of text that we put into the url bar and something amazing happens, some of these not even accessible - at least easily - through the user interface.
My goal with this post is to lay down some of these bad boys, who they are and what they do.
Result: opens a page with all the web part instances, effectively allowing us to manage (close, delete, etc.) web parts and very useful to troubleshoot problematic web parts
Query: ?ToolPaneView=2
Result: page opens automatically in edit mode
Query: ?ShowInGrid=True
Result: opens a view in quick edit (datasheet) mode for editing items in place
Query: ?filter=1&filterclear=1
Result: filter will enable the fields as filters and filterclear will ensure that the filters persist through out the session
Result: returns results with Portugal as country
Query: ?FilterField1=Country&FilterValue1=Portugal&FilterValue2=City&FilterValue2=Lisbon
Result: returns results with Portugal as Country and Lisbon as City
Query: ?FilterName=Country&FilterMultiValue=Portugal;United States of America
Result: returns results where the country is either Portugal or USA
Query: ?FilterName=Country&FilterMultiValue=*ortuga*;*states of ameri*
Result: returns results where the country is either Portugal or USA, while specifying only a subset of the string we want to search for
Result: This url will enable headings as filters, it will query results with Portugal as Country and Lisbon as City, and it will also look for results where the Subject contains either human resources or procurement
Throughout my travels, I have come by many of these magic strings of text that we put into the url bar and something amazing happens, some of these not even accessible - at least easily - through the user interface.
My goal with this post is to lay down some of these bad boys, who they are and what they do.
Old but gold, open the "Web Part Page Maintenance"
Query: ?contents=1Result: opens a page with all the web part instances, effectively allowing us to manage (close, delete, etc.) web parts and very useful to troubleshoot problematic web parts
Go into the current page's edit mode
If - for whatever reason - you need to open a page in edit mode, you can add this one.Query: ?ToolPaneView=2
Result: page opens automatically in edit mode
Open a view in quick edit mode
We can open up a view already in quick edit mode without users having to click List > Quick Edit.Query: ?ShowInGrid=True
Result: opens a view in quick edit (datasheet) mode for editing items in place
Open a view with headings as filters
List view fields can be used to filter out items, but this is not shown by default.Query: ?filter=1&filterclear=1
Result: filter will enable the fields as filters and filterclear will ensure that the filters persist through out the session
Filtering views with advanced query strings
This is by far the most helpful and flexible query string mechanism available in list views. So much so that I will need to have sub-categories for them:Filtering a single field with a single value
Query: ?FilterField1=Country&FilterValue1=PortugalResult: returns results with Portugal as country
Filtering multiple fields and with single values
Query: ?FilterField1=Country&FilterValue1=Portugal&FilterValue2=City&FilterValue2=Lisbon
Result: returns results with Portugal as Country and Lisbon as City
Filtering a single field with multiple possible values
Query: ?FilterName=Country&FilterMultiValue=Portugal;United States of America
Result: returns results where the country is either Portugal or USA
Filtering a single field with multiple possible values using wildcards
Query: ?FilterName=Country&FilterMultiValue=*ortuga*;*states of ameri*
Result: returns results where the country is either Portugal or USA, while specifying only a subset of the string we want to search for
Now let's put them all together
Query: ?Filter=1&FilterField1=Country&FilterValue1=Portugal&FilterValue2=City&FilterValue2=Lisbon&FilterName=Subject&FilterMultiValue=*human resources*;*procurement*Result: This url will enable headings as filters, it will query results with Portugal as Country and Lisbon as City, and it will also look for results where the Subject contains either human resources or procurement
Comments
Post a Comment