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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get all file names fro...
Power Automate
Unanswered

Get all file names from a SharePoint Document Library?

(0) ShareShare
ReportReport
Posted on by 387

Hi fellow Power Automate veterans,

 

Is there a way I can use Power Automate to extract all file names from a SharePoint Document Library? 

Perhaps like list in cmd where it keeps the folder path that'd be even better.

 

My current library structure is as follows:

 

My Document Library  (500+ files in total)

>

ABC123.xls

ABC224.xls

ABC302.xls

...
   >SubFolder 2021

2021_1.xls

2021_2.xls

...

   >SubFolder 2020

2020_1.xls

2020_2.xls

...

 

 

Many thanks.

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

    Hi @Australia,

     

    You could use a Send an HTTP request action for this and use the REST API to retrieve the items. You can apply a select to retrieve the FileLeafRef (file name).

     

    Below is an example of that approach

     

    _api/web/lists/getbytitle('Documents')/items?$select=FileLeafRef

     

    listallfiles_documentlibrary.png

  • Australia Profile Picture
    387 on at

    @Expiscornovus  many thanks for the prompt reply!

    I am just wondering if this API is free?

    How do I save the results as a CSV/Excel file?

    Possible to retain the folder name/path if possible?

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

    Hi @Australia,

     

    This is an action from the SharePoint connector (a non-premium one). The REST API is part of the SharePoint Online product, https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints.

     

    So, no additional licensing should be needed to use both.

     

    For a CSV you can use the Create CSV table action. Use the body/value output in the From field. You can use this expression for that:

     

     

    outputs('Send_an_HTTP_request_to_SharePoint')?['body/value']

     

     

    createcsvtable_fileleafref.png

     

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

    Hi @Australia,

     

    Apologies, forgot to respond to your Path question.

     

    Amend the uri to this please (added the FileRef field in the select) to also include the path:

    _api/web/lists/getbytitle('Documents')/items?$select=FileLeafRef,FileRef

     

  • Australia Profile Picture
    387 on at

    @Expiscornovus It works, marvellous! Thank you so much. Your solution helped me tremendously.

    Now I need to use Power Automate Desktop to upload these files to a website. Would you be the one to ask, too? IF yes, I can open a new post. 🙂

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

    Hi @Australia,

     

    Great to hear that it works 🙂

     

    I could help out with desktop flows. However, there are also a lot of other people who can help you too 😁

     

    Just post a new thread in this section:

    https://powerusers.microsoft.com/t5/Power-Automate-Desktop/bd-p/MPADesktop

     

  • Australia Profile Picture
    387 on at

    Thanks @Expiscornovus . I've just posted here: Upload files to a website in a loop? - Power Platform Community (microsoft.com)   😄

  • SallyTan1 Profile Picture
    2 on at

    Hi, are there any ways I can extract the file name so that I can have it on my list? 

     

    SallyTan1_1-1673542779815.png

    SallyTan1_2-1673542790971.png

     

  • CU23070452-1 Profile Picture
    on at

    @SallyTan1 wrote:

    Hi, are there any ways I can extract the file name so that I can have it on my list? 

     

    SallyTan1_1-1673542779815.png

    SallyTan1_2-1673542790971.png

     


    Add dynamic content -> under a suitable action that returns file properties, like "Get files (properties only)" (don't know what you have there before) click "File name with extension". If no extension needed, then "Name".

     

  • Abyshek Profile Picture
    2 on at

    Sorry for digging up this old thread. But, thanks a lot for providing the solution for extracting the file names from a Document Library. I now want to add those file names in a List as new items. Can you please guide me how to do it? I have tried the following but with no luck. 

     

    Abyshek_0-1701449746394.png

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard