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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,888)