Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

flow example using rest api to search sharepoint documents

(0) ShareShare
ReportReport
Posted on by

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

 

  • aliciawarner Profile Picture
    23 on at
    Re: flow example using rest api to search sharepoint documents

    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'
  • JatinSaini Profile Picture
    428 on at
    Re: flow example using rest api to search sharepoint documents

    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

  • Community Power Platform Member Profile Picture
    on at
    Re: flow example using rest api to search sharepoint documents

    @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.

  • Expiscornovus Profile Picture
    31,635 Most Valuable Professional on at
    Re: flow example using rest api to search sharepoint documents

    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
    on at
    Re: flow example using rest api to search sharepoint documents

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

     

    I need the result to go into a gallery 

     

  • Verified answer
    Expiscornovus Profile Picture
    31,635 Most Valuable Professional on at
    Re: flow example using rest api to search sharepoint documents

    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'&amp;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'&amp;selectproperties='Title,Author'

     

  • Community Power Platform Member Profile Picture
    on at
    Re: flow example using rest api to search sharepoint documents

    @Expiscornovus 

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

    dave

  • Expiscornovus Profile Picture
    31,635 Most Valuable Professional on at
    Re: flow example using rest api to search sharepoint documents

    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'&amp;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 🙂

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,594 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,928 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow