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

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / SharePoint Search REST...
Power Automate
Answered

SharePoint Search REST API not getting all files

(0) ShareShare
ReportReport
Posted on by 315

I have an app that I use to perform content search on two Teams libraries using a flow with the Send an HTTP request to SharePoint action.  The first library is the default library that is created with the Team and the second is a library that I created for archived files.  The content search on the archive library works as expected and the flow is able to pull in all documents.  On the default library, the flow is only pulling in some documents.   This is the Uri for the send Send an HTTP request action for each library:

 

Default library:
/_api/search/query?querytext='SearchString path:https://SharepointLink/teams/TeamName/Shared Documents/*'

Archive library:
/_api/search/query?querytext='SearchString path:https://SharepointLink/teams/TeamName/ArchiveDocuments*'

The SearchString is an input that comes from the app.

 

Both Uri's are basically the same except for the library name.  The default library has 604 files.  I've noticed that the flow returns 174 items when the Uri does not have the forward slash at the end of Share Documents.  With the forward slash, the flow returns 308 items.  I've tried to write the library name as Shared%20Documents in the Uri but that does not make anything better.  I have also tried reindexing this library a few times and it does not seem to do anything.  

 

Is there another way write the Uri or something else I can do on SharePoint to make this work they way it is supposed to?  

Categories:
I have the same question (0)
  • SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at

    @Alex-W 

    Try the Search tool to form your search query. It will let you identify the cause of the anomaly.

    PnP-Tools/Solutions/SharePoint.Search.QueryTool/README.md at master · pnp/PnP-Tools · GitHub

  • Alex-W Profile Picture
    315 on at

    @SudeepGhatakNZ I came across that tool while trying to figure this out, but I can't put that on my organization's environment.  

  • Verified answer
    Alex-W Profile Picture
    315 on at

    @SudeepGhatakNZ I cracked the code on this issue.  I downloaded the query tool on my personal computer just to see how it works with my SharePoint Online.  The functions of the tool did not help, but I noticed the query string did not have the document library name.  So, I took the library name out of the Uri:

     

    /_api/search/query?querytext='SearchString path:https://SharepointLink/teams/TeamName/*'

     

     This change brought in all documents from the default library and the archive library.  Since I need to separate both libraries in the content search, I added a refinement filter to only return items with a status of "Current".  The Uri now looks like this:

     

    /_api/search/query?querytext='SearchString path:https://SharepointLink/teams/TeamName/*'&refinementfilters='RefinableString03:equals("Current")'

     

    My app works as expected now, but I wish I knew why the Uri setup for the default library did not work like it does for the archive library.  

     

    Anyway, for those of you that are looking at the updated Uri and do not understand the refinement filters section... I have a column on the library called, "Status" and it has choices for Current and Archived.  All files in the default library have a status of Current.  When it is changed to Archive, another flow runs and moves it to the archive library.  To get this content search flow to filter by this column, I had to go into the SharePoint Search Schema and map RefinableString03 to the Status column.  The column could be mapped to any RefinableString.  I am using RefinableString03 because I have other things mapped to RefinableString00 - 02.   

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!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 237 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 176 Super User 2026 Season 1

#3
Power Platform 1919 Profile Picture

Power Platform 1919 96 Super User 2026 Season 1

Last 30 days Overall leaderboard