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 / flow example using res...
Power Automate
Answered

flow example using rest api to search sharepoint documents

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Does anyone have a video or example on using flow with rest api to search sharepoint documents.

 

I have this one:

https://sharepains.com/2018/08/28/sharepoint-rest-api-power-automate/

 

are there anymore examples.

I need to search ppt and docx  files.

 

Thanks

Dave

 

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

    Hi @Anonymous,

     

    You can for example use the SharePoint Search REST API for this:

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

     

    Below is an example which is using for the following keywords 'test filetype:docx'. Because I am adding filetype:docx SharePoint knows it has to look for a docx in the filetype field.

    _api/search/query?querytext='test filetype:docx'&selectproperties='Title,Author'

     

    searchrestapi.png

     

    The structure of the response json is a bit more complicated, a lot of nested json 😁

    Below is an example of an expression which collects the first item of the search result set.

    outputs('Send_an_HTTP_request_to_SharePoint')?['body']['d']['query']['PrimaryQueryResult']['RelevantResults']['Table']['Rows']['results'][0]['Cells']['results']

     

    firstresults_searchapi.png

     

    Hope this helps to get you started 🙂

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Expiscornovus 

    If I wanted to search for a  phrase  "communication strategy".. where would that go in the example ?

    dave

  • Verified answer
    Expiscornovus Profile Picture
    33,853 Most Valuable Professional on at

    Hi @Anonymous,

     

    You can replace the text between the single quotation marks after the querytext parameter.

     

    If you just want to look for that phrase in all file types that would be:

    _api/search/query?querytext='Communication Strategy'&selectproperties='Title,Author'

     

    If you are looking for a Word document with that phrase it would be:

    _api/search/query?querytext='Communication Strategy filetype:docx'&selectproperties='Title,Author'

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    ok, what exactly do I do with the Compose part ?

     

    I need the result to go into a gallery 

     

  • Expiscornovus Profile Picture
    33,853 Most Valuable Professional on at

    Hi @Anonymous,

     

    The compose action was just an example. You could use that expression in other type of Power Automate actions.

     

    Just to double check, what kind of gallery are you talking about? Do you mean a gallery control within a Power Apps app by any chance?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Expiscornovus 

    Do you mean a gallery control within a Power Apps app by any chance?  = Yes

    I finally got the schema to work.

    If I need to take this question further to powerapps I can. bUT I  will also need to pass the query text parameters from powerapps..a textbox..on the screen.

     

    Thanks

    Dave

     

     

     

    I got everything working so far...no errors and it is finding my text.

     

    Thanks.

  • JatinSaini Profile Picture
    428 on at

    HI @Expiscornovus ,

    I just replicated your formula for the search query. The only thing which am curious about is that how can I modify your shared query formula if I wanna add a path to a sharepoint document library and search within that only? PLEASE HELP

  • aliciawarner Profile Picture
    23 on at

    Not sure if you still need this, but I was working on the same thing. The way I did it was by modifying the querytext to go to only the Site Pages library.

     

    /_api/search/query?querytext='path:https://contoso.sharepoint.com/sites/<sitename>/SitePages'&selectproperties='ViewsLifeTime,ViewsLifeTimeUniqueUsers'

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 791

#2
Valantis Profile Picture

Valantis 568

#3
Haque Profile Picture

Haque 535

Last 30 days Overall leaderboard