Forum Discussion

EiC4733's avatar
EiC4733
Brass Contributor
Jul 20, 2022
Solved

Search fields / search query in a list and webpart

Hello,
I would like to know if it is possible to create a search box on a sharepoint page and if so, how to do it?

 

The idea would be to allow the integration on a site page of a "search field" (i.e. a search area to be filled in) which would check if the element is present in a list.

 

For example, I have a client list.
Before creating a new customer, the name is entered in a search field and this checks the correspondence in a list.
If the customer is existing, we receive a message with a link, for example, to the item in the list

  • EiC4733's avatar
    EiC4733
    Aug 04, 2022

    DaveMehr365 

    Thanks a lot,

    This is exactly what I was looking for. I still have to get started with the tool to be able to configure the search in a very specific list.

     

    thanks again

4 Replies

  • Hello EiC4733

     

    you can use a SharePoint Search Box to search a list. It's my preferred solution to configure a custom search page for this case. For SahrePoint Online you can use the PnP Modern Search WebParts: https://microsoft-search.github.io/pnp-modern-search/scenarios/ 

    For classic, it's a WebPart, SharePoint Search Box, available.

     

    Or with this guide you can create your search box:

    https://www.codesigned.com/blog/how-to-create-a-custom-sharepoint-search-box-jquery

     

    Regards, Dave

    • EiC4733's avatar
      EiC4733
      Brass Contributor
      Given my skills and my bad English, could you provide me more details on how to configure pnp search to fix the search in a specific library or list and not in the whole site?
      • Hello EiC4733 

         

        add a new search page with a Search Results Web Part: https://microsoft-search.github.io/pnp-modern-search/scenarios/create-simple-search-page/

         

        When you edit the Results Web Part, you can configure the query unter Query Template (page 1 in Web Part configuration). Your Query looks like this:

        {searchTerms} path:https://<TENANT>.sharepoint.com/sites/DocumentStore/TechContent/ IsContainer<>true

         

        path: is the direct path to your library

        IsContainer<> exclude folders, when you don't have folders, you can delete the parameter IsCointainer<>true

         

        On page 3 in your Result Web Part, you can connect to an Search Box, when you use both.

         

        Hope this helps.

         

        Regards, Dave

         

        **When you like my work, mark as best answer and give a like to the answer 

    • EiC4733's avatar
      EiC4733
      Brass Contributor

      DaveMehr365 

      Thanks a lot,

      This is exactly what I was looking for. I still have to get started with the tool to be able to configure the search in a very specific list.

       

      thanks again

Resources