cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NVisa
Frequent Visitor

When file created on SharePoint, send email to specific person according to file name

Hi all,

 

I'm currently new to Microsoft Flow.

 

My scenario is whenever an Excel file has been created in SharePoint, it will automatically send an email to specific person according to file name.

The logic is that Excel file naming is the person name, then Flow can get the ID or contact email that will be then send to that specific person.

 

For example, Excel file name "Amily.xlsx" has been created, then it'll automatically send an email to Amily.

                      Excel file name "John.xlsx" created, it'll then send an email to John.

 

Could this scenario work by using Microsoft Flow?

I have try create some flow as per below but it didn't work:

Capture.PNG

 

Thank you.

 

Regards,

Tar

5 REPLIES 5
ScottShearer
Super User
Super User

@NVisa 

You can likely achieve your goal by parsing the filename with extension (use the split() expression and the Office 365 Users search for users action.  That said, this isn't a great approach in a large organization.

Please see my example below.  Any expressions that I used can be seen in the comments area for the associated action.  The split expression is necessary because of your requirement to send an email only for Excel files - that means you need the file extension.

If you use this solution, you'll probably want to add logic to handle situations where the user cannot be found.

 

FindUser.jpgFindUser1.jpgFindUser2.jpg

 

FindUser2.jpg

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

Scott
Gristy
Resident Rockstar
Resident Rockstar

Hi,

 

Name from the trigger already does not have file extension so no need to use split.

 

make sure you put a ; in-between each email address in the email action.

 

Few other things to note:

1) Get my profile action will get the user that the connection is setup for. Select fields is optional.

2) As mentioned above search for users is what you need

 

I suggest you add a meta-data field with Person type, and get them to populate the user in there as Scott mentions in a big organisation there will be lots of John's

v-alzhan-msft
Community Support
Community Support

Hi @NVisa ,

 

Please refer to screenshot below to create the flow:

1.png

 

Best regards,

Alice       

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

NVisa
Frequent Visitor

Hi @ScottShearer,  @v-alzhan-msft , @Gristy 

 

First of all, thank you for all your replies and sorry for late response, I have tried all approached that you guys suggested but it still didn't work when I place excel file with Employee Full name. I also make sure to use ; in the between each mail address.

 

At first I suspect it could be that my SharePoint site was confidential site, then I request IT to change to Public site. The flow still didn't work.

 

When I test those approaches, it always end up with this below:

Capture.JPG

 

I think it might be because it can't fetch up an employee's email from organization with only full name?

 

Regards,

Tar

NVisa
Frequent Visitor

And the other time when run test, it show:

 

Capture.JPG

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (3,394)