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 / File Survey in SharePo...
Power Automate
Unanswered

File Survey in SharePoint Library for new files and send mail to recipient list with these files

(0) ShareShare
ReportReport
Posted on by 20

Hi all, 

I'm new to PowerAutomate and it seems the process I'm looking for is not the easiest to start with (at least for me as a newbie). So here we go: 

I have a SharePoint Library and I'd like to survey one subfolder every day (at 8 in the morning) for new files. The relevant new files contain a certain string pattern ('1079' or '1081'), all other new files without that pattern should not be considered.

Next, I want to sent these files to a mail distribution list and mention the name of that new files in the main text body of the mail.

If there are no new file, no email should be sent.

Sounds simple... hope for you it is, wasn't for me 😄 

 

Any help is highly appreciated.

Categories:
I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    on at

    Hi @BenMielichSuess ,

     

    Could you please share more details about your scenario? What does the mail distribution list look like? How to know who are the recipients of the Email?

     

    I have made a flow as the demo for your reference, which could get all the files you need every day, get all the file names as well as combine them together into an array that could be used in Send Email action. The problem now is that the To parameter of Send an Email action, without knowing the list details, I'm not able to give your more advice.

     

    Flow I built:

    vjefferni_0-1690526906110.png

    vjefferni_4-1690527413499.png

    vjefferni_2-1690527172195.png

    vjefferni_3-1690527186274.png

     

    expressions:

    filter query in Get files:

     

     

    (substringof('1079',FileLeafRef) or substringof('1081',FileLeafRef)) and created lt '@{addDays(utcNow(),-1)}'

     

    Condition:

    empty(outputs('Get_files_(properties_only)')?['body/value']) is equal to true
     
    Compose:
    join(body('Select'),', ')
     

    Best regards,

     

  • BenMielichSuess Profile Picture
    20 on at

    Hi, 

     

    this looks already pretty good to me! 

     

    I was setting up the flow as you suggested, but I get following error message for the "Get files (properties only)":

    BenMielichSuess_0-1690531272766.png

     

    I'm not sure how to fix this?

     

    Concerning the mail recipients: I didn't spend many thoughts on the email recipient list tbh. It's not a big list (about 20-30 recipients). I thought that I could simply enter it into the flow manually, but that would be a rather static option...Now thinking about it, something more dynamic would be cool, to allow adaptions of the recipient list over time. I could think of an excel table stored in the same sharepoint that contains the mail addresses, would that work? 

     

    Thanks a lot for the fast and detailled response!

     

  • v-jefferni Profile Picture
    on at

    Hi @BenMielichSuess ,

     

    Sorry, the column name is case sensitive, so please try:

    (substringof('1079',FileLeafRef) or substringof('1081',FileLeafRef)) and Created gt '@{addDays(utcNow(),-1)}'

     

    Speaking of recipients' Emails, using a list or Excel table is fine, you can get items from list or list rows from Excel table, then use a join function to concatenate all the Emails together with semicolon and set in To paremeter.

     

    Best regards,

  • BenMielichSuess Profile Picture
    20 on at

    Hi, 

     

    thanks for the bugfix. Indeed the flow runs now without errors. However, I do not receive any emails if I create a test-file (e.g. "1079_test.txt") to the respective folder in the sharepoint library? 

    Do you know what the issue could be? 

     

    Thanks a lot!

  • v-jefferni Profile Picture
    on at

    Hi @BenMielichSuess ,

     

    You need to go to flow run history, see if there are files be found in Get files (properties only) action. 

     

    Best regards,

  • BenMielichSuess Profile Picture
    20 on at

    Hi, 

     

    i think it did not propagate the infos into the array: 

    Here's a screenshot from the history after the if yes/if no: 

    BenMielichSuess_0-1690789003744.png

     

    However, i received an email yesterday with no content (no file attachements; only title, no body), and the file was pasted 3 days ago to the sharepoint and the recurrence of checking is set to 1 day...

     

    Here's again my flow, hope there's no error somewhere?

     

    BenMielichSuess_1-1690789275975.png

    BenMielichSuess_2-1690789309455.png

     

    BenMielichSuess_3-1690789339411.pngBenMielichSuess_4-1690789402772.png

    BenMielichSuess_5-1690789473849.png

     

     

  • v-jefferni Profile Picture
    on at

    Hi @BenMielichSuess ,

     

    It's incorrect in Select.

    vjefferni_0-1690789927611.png

     

    Best regards,

  • BenMielichSuess Profile Picture
    20 on at

    Cool, thanks @v-jefferni, for all your efforts!

    That step seems to be fixed , but now the "Send an email" block gives me following error: 

     

    BenMielichSuess_0-1690790512666.png

     

     

  • v-jefferni Profile Picture
    on at

    Hi @BenMielichSuess ,

     

    I found that you have the wrong condition in Condition control. It should be "is not equal to".

     

    BR,

     

  • BenMielichSuess Profile Picture
    20 on at

    Thanks for pointing it out. I also noticed it and it was already changed before I got the error message from the "send an email" block, so unfortunately this is not the issue...

     

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard