Share via

Sharepoint PNP Search Function

Anonymous
2024-06-05T03:13:10+00:00

I need to set up a PNP search function to only search a specific site, only shows documents, and doesn't show any results when no criteria is entered. 

The below query works how I want it to search, however it shows results when I haven't entered in any criteria.

{searchTerms} IsDocument:1 -fileextension:aspx Path:"https://yourtenant.sharepoint.com/sites/yoursite*"

By just entering in:

{inputQueryText}

it only shows results when I have entered in a search criterion, however it doesn't allow me to restrict my results to 1 site and document type. 

Any help would be appreciated. Thanks

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-06-05T04:05:29+00:00

    Dear Olivia Nolte,

    Good day!!

    I understand your concern but since it’s related PnP Search in the SharePoint Online, I would like to suggest you raise a new issue in the related forum i.e., Issues · microsoft-search/pnp-modern-search · GitHub to get the detailed help from the developers.

    In addition, I would also like to suggest you cross-post your concern in the related community i.e., Ask a question - Microsoft Q&A with SharePoint Development tag to get the detailed help from the experts.

    Apologies for redirecting you to different community as the members in the category posted focus on the users with out of the box concerns on SharePoint Online, and have limited knowledge on the PnP custom search; so to get the fast and better assistance, we have redirected you in the correct path.

    Appreciate your patience and understanding. Have a great day!!

    Best Regards,

    Sophia

    Was this answer helpful?

    0 comments No comments