cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hgbi
Level: Power Up

Email most recent file from SharePoint documents folder

Been searching all over for this, but nothing that gets me exactly what I need.

 

Ultimate goal: Send an email with an attachment of the most recently modified Excel file from a SharePoint folder where the file starts with a specific string.

 

The folder has multiple files, some with the same naming convention. For example "Top Customers - yyyy-MM-dd.xlsx".  I want to be able to filter down to the file that starts with "Top Customers" and has the most recent last modified date (last modified on the file property, not necessarily the date listed in the file name itself.

 

Once I filter down to this single file, I want to send it as an attachment via Outlook email. I've done this step many times, but filtering down to a single file has been my headache.

3 REPLIES 3
Super User
Super User

Re: Email most recent file from SharePoint documents folder

Hi @hgbi ,

 

I have built one flow and here are the steps you needed.

 

b1.png

Above 'aj' is my document library. 

Filter Query you need to use 'FileLeafRef' which is the Title of the document.  You can't use Title or Name here. It will return nothing. Top tip 🙂

b2.png

 

Here are my run results:

b3.png

 

If you need further help please let me know.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



Super User
Super User

Re: Email most recent file from SharePoint documents folder

@hgbi :

I agree with @abm but suggest that the filter query be expanded so that only Excel files are returned:

FileLeafRef.jpg

To send the email, refer to the post by @abm 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
cwebb365
Level 10

Re: Email most recent file from SharePoint documents folder

Some nice Filter Query examples here. Thanks guys 🙂

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,192)