Interview Questions administrator

Best SharePoint administrator Interview Questions and Answers with topic wise:


Recycle Bin | MMS | ManagedVsCrawledProperties |

Thursday, February 23, 2012

Faster way to search the items in a sharepoint list and libraries:


Using the URL to sort or filter a list or library [or] Filter a SharePoint List with Query String Parameters

Did you know that you easily can filter your SharePoint list or library with values in your URL? That means without using “Views “option. This one’s very useful when you’re having a lot of items in a list or document library and you need a quick filter.

The syntax is as follows:

< URL to List or Library >/Forms/AllItems.aspx?FilterField[X]=[Column to Filter]&FilterValue[X]=[Value]
·          
       [X] is the number of filter's you're applying.  The first set will always be 1, the next set 2, etc.
·         [Column to Filter] is the internal name of the column you wish to filter, such as Title.
·         [Value] is the value you wish to filter on.
FilterFieldX and FilterValueX must always be used in pairs.  Take for example the following URL:
http://server/site/ DocLibName /Forms/AllItems.aspx?FilterField1=Status&FilterValue1=Active

To search for multiple values:
http://server/site/ DocLibName/Forms/AllItems.aspx? FilterField1=Status&FilterValue1=Active&FilterField2=Title&FilterValue2=DocName

Question:  A site has a document library and that document library contains many documents (assume 10,000 docs). Each document has set as status option like Active, Inactive, and Completed etc...  Now my requirement is I want to show the list of “Active” status documents only.
I knew everyone’s answer is by using “views” filtering option we can get the list of “Active” status documents only easily. Even I also approached this solution. But one of my colleagues suggested me search the list of “Active” status documents only through browser.

Here is the solution to show the list of “Active” status document only through browser.

Ans: FilterField1=FieldName&FilterValue1=Itemvalue
e.g. http://sername/sitename? FilterField1=StatusField&FilterValue1=Active
*StatusField is your custom fieldname
* Active is StatusField option.

Hope all you understood my approach guys. It’s too simple right...

Now, I will explain bit more clearly with UI.
Step1: Create a document library (Name: Search Document)
Step2:  Create a “Status” dropdownlist field with option: Active, Inactive and Completed…
Step3: Now, upload the many documents in the document library.

   
Step4:  Now, Start the search for the list of “Active” status documents by using “FilterField1” and “FilterValue1”options.

Note: FilterField1 and FilterValue1 are case sensitive.



Final Result:

    

References:

Happy Coding…


No comments:

Post a Comment