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

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Send a customized emai...
Power Automate
Unanswered

Send a customized email when a new file is added - limit to extension name and file names

(0) ShareShare
ReportReport
Posted on by 6

Dear all,

 

I have some issues with Power Automate.

 

When using Sharepoint, I would like to notify a recipient when a new file with a specific extension and file name is created.

For example, I want to send a mail to xy@mail.com that an Excel file with file name starting with "12345" has been saved on this link.

 

However, I cannot find any options for filtering for file extensions or file names in my flow.

 

image.png

 

Can anybody help me please if such filtering is possible?

 

Thank you in advance

Categories:
I have the same question (0)
  • DPozzi Profile Picture
    124 on at
    Re: Send a customized email when a new file is added - limit to extension name and file names

    I'm not an expert but may I ask which trigger you use? if it's the creation or modification of an item in a sharepoint document library, maybe you could create a variable with the extension trimming the filename of the created file then you could use a conditional check

  • konczera Profile Picture
    6 on at
    Re: Send a customized email when a new file is added - limit to extension name and file names

    It's a creation of an item. I am quite a beginner in Power Automate, could you please show how to execute your advise?

    Thanks in advance

  • DPozzi Profile Picture
    124 on at
    Re: Send a customized email when a new file is added - limit to extension name and file names

    I'm not a pro too but I'll try to help, so the trigger must be "when a file is created  in a folder"

    DPozzi_0-1664293268503.png

    then let's init a variable spliting the file identifier from the trigger: split(triggerOutputs()?['headers/x-ms-file-id'], '.')

    DPozzi_0-1664299525486.png

    DPozzi_4-1664300060144.png

     

    then init the Extension variable

    DPozzi_1-1664299637220.png

    variables('FileIdentifier')[1]
     
    the variables()[index] will extract the value from the array in that case the part after the "." 
    I'm not considering that the filename could have other "." other than one before the extension but it's just to give you an idea.
     
    DPozzi_2-1664299899423.png

     

    alternative/in addition with "GET FILE METADATA" using the same file identifier from the trigger you can get other info, like the filename or the media type

    DPozzi_3-1664299962251.png

     

    Then you can use conditional control to perform specific action if it's an image, doc, xlsx etc etc.

    I hope that this will help you ^_^

  • konczera Profile Picture
    6 on at
    Re: Send a customized email when a new file is added - limit to extension name and file names

    Hello,

    thanks for the help.

     

    When testing the flow, I got this error message for Initialize variable 2:

    "Unable to process template language expressions in action 'Initialize_variable_2' inputs at line '0' and column '0': 'The template language function 'split' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#split for usage details.'."

     

    I suppose I have to adjust something in this command?

     

    konczera_1-1664438368982.png

    split(triggerOutputs()?['headers/x-ms-file-id'], '.')

  • DPozzi Profile Picture
    124 on at
    Re: Send a customized email when a new file is added - limit to extension name and file names

    Your trigger is different than mine

    DPozzi_0-1664442370803.png

     

    it's not a problem but you can't copy paste my previous command, with this trigger it will change as:

     

    split(triggerOutputs()?['body/{Identifier}'], '.')

     

    due the trigger answers with a different set of properties

     

  • konczera Profile Picture
    6 on at
    Re: Send a customized email when a new file is added - limit to extension name and file names

    Thank you a lot, it worked!

     

    Do you know if there is an option to limit the automated e-mail sending to a special file names only? For instance, there are many files created on a link, but I only want to send notification if an excel file containing the name "12345" is created.

     

    Thanks in advance.

  • DPozzi Profile Picture
    124 on at
    Re: Send a customized email when a new file is added - limit to extension name and file names

    I'm glad it worked, about the mail you should add a conditional step before the mail sending phase, with two conditions, extension eq xlsx AND filename contains "12345"

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

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard