Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

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

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 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.




Can anybody help me please if such filtering is possible?


Thank you in advance

Helper II
Helper II

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

Regular Visitor

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

Helper II
Helper II

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"


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




then init the Extension variable


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.


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



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 ^_^

Regular Visitor


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 for usage details.'."


I suppose I have to adjust something in this command?



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

Your trigger is different than mine



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


Regular Visitor

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.

Helper II
Helper II

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"

Helpful resources

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (3,681)