cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

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
Highlighted
Super User III
Super User III

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!

Learn more from my blog
Highlighted
Super User III
Super User III

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
Highlighted
Impactful Individual
Impactful Individual

Re: Email most recent file from SharePoint documents folder

Some nice Filter Query examples here. Thanks guys 🙂

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (5,944)