web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Filter Search HTTP Req...
Power Automate
Answered

Filter Search HTTP Request to SharePoint

(0) ShareShare
ReportReport
Posted on by 327

Is it possible to filter an HTTP Request to SharePoint that is used to query a document library?

 

I am building a power app with a search feature that allows the users to search the contents of files in a document library.  I have a Uri that works for the entire library but I would like to focus the search on a set of documents tagged with a particular metadata.  This is my Send an HTTP Request to SharePoint setup:

 

 

Site address: MySite

Method: GET

Uri: /_api/search/query?querytext=%27[SearchText]%20path:https://myDocLib*27&RowLimit=30

Headers: 
 Content-Type - application/json
 Accept - application/json

 

 

I tried to add a filter by looking at how SharePoint filters a library and it did not work.  Power Automate allowed me to add the following to the Uri with no errors, but the search results are still from the entire library:

 

 

added this -->&FilterField1=Category&FilterValue1=%27CategoryName%27<--

/_api/search/query?querytext=%27[SearchText]%20path:https://myDocLib*27&FilterField1=Category&FilterValue1=%27CategoryName%27&RowLimit=30

 

 

So, is there there a way to filter this?

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,851 Most Valuable Professional on at

    Hi @Alex-W,

     

    What you are using is a query string Url for filtering a list or library in the interface:

    https://learn.microsoft.com/en-us/microsoft-365/community/query-string-url-tricks-sharepoint-m365#filter-lists-and-library-views-by-column-values-with-filterfield-and-filtervalue

     

    The filterfield1 is not a query parameter of the SharePoint Search REST API. Below is the full list of query parameters which you can use in that service:

    https://learn.microsoft.com/en-us/sharepoint/dev/general-development/sharepoint-search-rest-api-overview#using-query-parameters-with-the-search-rest-service

     

    I would suggest to have a look at the refinementfilters query parameter instead:

    https://learn.microsoft.com/en-us/sharepoint/dev/general-development/sharepoint-search-rest-api-overview#refinementfilters

     

     

  • Verified answer
    Alex-W Profile Picture
    327 on at

    @Expiscornovus I've been to that SharePoint Search REST API site before and I could not find a solution at the time.  I did more research and found out I was taking the wrong approach at this issue.  Like I said in my original post, I was trying to filter the request by using basic SharePoint type filters, but this is not basic at all.  The solution I found involves the search schema settings on SharePoint.

     

    This is what's kind of working for me:

     

    1. Go the search schema settings on SharePoint

    2. Select one of the RefinableString managed property under Managed Properties (I selected RefinableString00)

    3. Scroll down to the bottom of the RefinableString00 settings page and click on "Add a mapping" to the "Mappings to crawled properties"

    4. Search for the column that contains the metadata that will be filtered.  For my requirement, this the category column and when I searched for it, I saw a crawled property for ows_Category that I selected.

    5. On the HTTP request on Power Automate, I updated the Uri with the following after the path string:

     

    &selectedproperties='RefinableString00'&refinementfilters='RefinableString00:equals("CategoryName")'

     

      

    The reason I said this kind of works is because I am only able to get it to work on one of my sites so far.  I am comparing the site settings now to see if I can find the difference between the site that does work versus the sites that do not work.  If I can figure it out, I will update this post.    

     

    ===Update===

     

    I found the issue with the sites that did produce any results with the flow.  I went to the libraries advanced settings and turned on Index Non-Default Views and then clicked the Reindex Document Library button.  Nothing happened at first, but after about one hour, it started working.  

     

    My method of getting this work with a metadata column may not be the best way, but it's working great for me.  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 801

#2
Valantis Profile Picture

Valantis 602

#3
Haque Profile Picture

Haque 581

Last 30 days Overall leaderboard